http: RequestBodyBufferMiddleware: 411 No Content Length for GET requests?
I’m doing some testing with Guzzle as client and I’m running into unexpected behaviour- 411 instead of qualified response.
In https://github.com/reactphp/http/blob/abdf36ee15e3e17e292943ffd4a85d13aa01284c/src/Middleware/RequestBodyBufferMiddleware.php#L35 an HTTP 411 is returned when Content-length
is not set. According to https://stackoverflow.com/questions/8540931/what-is-the-correct-content-length-to-set-for-a-get-request this requirement should not be necessary.
A message-body MUST NOT be included in a request if the specification of the request method (section 5.1.1) does not allow sending an entity-body in requests.
IMHO that would mean that the 411 should not be returned for GET requests and instead 0 assumed.
cc @WyriHaximus
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 20 (15 by maintainers)
@andig Re: https://github.com/reactphp/http/issues/120#issuecomment-336154503 I’ve had a call with @clue earlier this week regarding this and other issues and we’re going to make one minor change to
RequestBodyBufferMiddleware
and that is to pass the max size onto thebuffer
function. (And remove the length header check of course.) There is a PR adding the argument required for it https://github.com/reactphp/promise-stream/pull/3 so we can do that. We really appreciate your work on #235 but prefer this simpler way to go. Another thing is that the chunked encoding is already handled underwater by the server so moving it to the middleware would break that.