Hello friends! I’m trying to help some folks with with httpc, but we’ve got a bit stuck.
HTTP (RFC 9110) specifies some standard methods (GET, POST, etc), but it permits other methods. WebDAV (RFC 4918) defines some extension methods (PROPFIND, PROPPATCH, etc) which these folks wish to use.
HTTPC today
When making a request with httpc:request it checks if the method and returns an error if it is not one of the methods listed in RFC 9110, even if the method is valid according to the RFC:
The ?WITH_BODY and ?WITHOUT_BODY lists contain all the standard methods, so for non-standard methods check_request(false, false, Request) is called.
If the first two argument are false an error is returned, rejecting the valid HTTP request.
Why might it do this?
My suspicion is that this is motivated by the desire to split methods into those that permit a body, and those that do not, as the convention and the behaviour that web browsers implement.
However, RFC 9110 don’t seem to say that `?WITHOUT_BODY` requests cannot have a body. For example, for GET it says:
"A client SHOULD NOT generate content in a GET request unless it is made directly to an origin server that has previously indicated, in or out of band, that such a request has a purpose and will be adequately supported.“.
The older RFC 7231 also seems to permit any method to have a body, but specifies that the semantics of a body for certain methods is undefined:
A payload within a GET request message has no defined semantics
My reading is that in order to enforce this convention with the standard methods it has banned spec compliant non-standard methods, as they don’t fall into this convention.
Moving forward
From reading the source code I was unable to find a way to avoid this check in httpc, so it seem that it only permits a subset of valid methods, and standards such as WebDAV are blocked.
Assuming I’m right, I think it would be reasonable to remove this check, so httpc can be used for more tasks, instead of forcing use of a third-party HTTP client.
I would be in favour of removing the method-specific body behaviour entirely, letting the programmer decide if a body is included, but another option would be to permit a body for any method not in ?WITHOUT_BODY.
What do you think? Did I miss anything?
Thanks you! Louis