laanwj
commented at 3:35 PM on October 1, 2020:
member
We don't set any Content-Type in the client. It is more consistent with our other JSON-RPC use to set it to application/json.
Note that our server doesn't enforce content types, so it doesn't make a difference in practice. But it is fairly strange HTTP behavior to not set it at all for a POST request.
We don't set any `Content-Type` in the client. It is more
consistent with our other JSON-RPC use to set it to `application/json`.
Note that our server doesn't enforce content types, so it doesn't make a
difference in practice. But it is fairly strange HTTP behavior to not set it.
This came up in #18950.
7eab781a14
laanwj added the label RPC/REST/ZMQ on Oct 1, 2020
promag
commented at 3:39 PM on October 1, 2020:
member
Note that our server doesn't enforce content types
Should?
practicalswift
commented at 4:04 PM on October 1, 2020:
contributor
Concept ACK
laanwj
commented at 4:08 PM on October 1, 2020:
member
Should?
As it would be an interface change that affects any applications that mimicked previous -cli behavior, or followed the (strange) advice to set text/plain content type, I don't really think that's a good idea. It seems unnecessary.
practicalswift
commented at 5:50 PM on October 1, 2020:
contributor
jonatack
commented at 6:27 PM on October 1, 2020:
member
(Should the RPC helps content type be updated? In practice it doesn't seem to make much difference except what is seen in the server header: text/plain, application/json, or when no content type is specified, application/x-www-form-urlencoded)
laanwj
commented at 6:52 PM on October 1, 2020:
member
Should the RPC helps content type be updated? I
Are we mentioning that anywhere?
jonatack
commented at 6:54 PM on October 1, 2020:
member
ISTM all the help examples ATM say -H 'content-type: text/plain;' for the curl.
kristapsk
commented at 7:14 PM on October 1, 2020:
contributor
Isn't these just extra bytes transferred without any benefit? It's not that somebody will use bitcoin-cli against anything else than Bitcoin Core, so there isn't any need to care about "fairly strange HTTP behaviors" IMO.
practicalswift
commented at 7:39 PM on October 1, 2020:
contributor
Isn't these just extra bytes transferred without any benefit?
I think it makes sense to pass Content-Type consistently in all our code.
From the spec FWIW: "Any HTTP/1.1 message containing an entity-body SHOULD include a Content-Type header field defining the media type of that body. If and only if the media type is not given by a Content-Type field, the recipient MAY attempt to guess the media type via inspection of its content and/or the name extension(s) of the URI used to identify the resource. If the media type remains unknown, the recipient SHOULD treat it as type "application/octet-stream"."
It's not that somebody will use bitcoin-cli against anything else than Bitcoin Core, so there isn't any need to care about "fairly strange HTTP behaviors" IMO.
I can think of testing scenarios where one would like to run bitcoin-cli against something other than Bitcoin Core (such as against a fuzzing HTTP server) :)
promag
commented at 7:44 PM on October 1, 2020:
member
ACK7eab781a145a35d0373c4ab4d237a82b4919e88d.
@laanwj on the server we could check if content type header is valid iff is set.
laanwj closed this on Oct 1, 2020
laanwj
commented at 9:08 PM on October 1, 2020:
member
Isn't these just extra bytes transferred without any benefit? It's not that somebody will use bitcoin-cli against anything else than Bitcoin Core, so there isn't any need to care about "fairly strange HTTP behaviors" IMO.
Well if you're worried about a few extra bytes being transferred locally have it your way I guess, closign …
laanwj
commented at 9:12 PM on October 1, 2020:
member
ISTM all the help examples ATM say -H 'content-type: text/plain;' for the curl.
That's a kind of bad suggestion, thanks for telling me where it comes from though. Not sure it's worth changing, it's okay, it doesn't really affect anything.
promag
commented at 9:12 PM on October 1, 2020:
member
@laanwj I think you closed by accident, they should put more space between those buttons.
@kristapsk this is clearly the right thing to do as a JSON-RPC over HTTP client.
sipa
commented at 9:13 PM on October 1, 2020:
member
Yeah, I also don't understand why this was closed.
Concept ACK
laanwj
commented at 9:21 PM on October 1, 2020:
member
@laanwj I think you closed by accident, they should put more space between those buttons.
Because I don't really feel like having an argument about a one-line change that I thought was fairly obvious. I noticed this was off, and we can make this change or not, but if people think it's controversial I'm sure there's more important things.
practicalswift
commented at 6:20 AM on October 2, 2020:
contributor
Please consider re-opening.
Review comments should only be considered to they extent they have technical merit.
A single semi-negative comment does not necessarily make a change "controversial" :)
fanquake reopened this on Oct 2, 2020
promag
commented at 7:17 AM on October 2, 2020:
member
ACK
fanquake approved
fanquake
commented at 7:24 AM on October 2, 2020:
member
ACK7eab781a145a35d0373c4ab4d237a82b4919e88d - Looks fine to me.
fanquake merged this on Oct 2, 2020
fanquake closed this on Oct 2, 2020
kallewoof
commented at 8:24 AM on October 2, 2020:
member
Post-merge utACK
Fabcien referenced this in commit 32be44adf4 on Nov 3, 2021
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:14 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me