Opened 2 years ago

Closed 23 months ago

#3521 closed bug (Fixed)

Content-type's charset should be accepted and probably ignored for jsonrpc communication

Reported by: ibizaman Owned by:
Priority: minor Milestone: 2.1.0
Component: Web UI Version: 2.0.0
Keywords: Cc:

Description

Sending a request with 'Content-Type: application/json' works fine:

$ curl 'http://127.0.0.1:8112/json' -X POST \
       -H 'Content-Type: application/json' \
       --data-raw '{"method":"daemon.get_version","params":[],"id":1}'
{ "result": null
, "error": { "message": "Not authenticated"
           , "code": 1
           }
, "id": 1}

But it should work too with 'Content-Type: application/json;charset=utf-8' although it doesn't:

$ curl 'http://127.0.0.1:8112/json' -X POST \
       -H 'Content-Type: application/json;charset=utf-8' \
       --data-raw '{"method":"daemon.get_version","params":[],"id":1}'
{ "result": null
, "id": null
, "error": { "code": 5
           , "message": "JSONException: Invalid JSON request content-type: application/json;charset=utf-8"
           }
}

This is a valid content-type as per https://greenbytes.de/tech/webdav/rfc2616.html#header.content-type
I believe I know how to fix this and will create a PR for it.

Change History (1)

comment:1 Changed 23 months ago by Cas

  • Component changed from Unknown to Web UI
  • Milestone changed from needs verified to 2.1.0
  • Resolution set to Fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.