http
http copied to clipboard
HTTP client: Support for expect-continue (`Expect: 100-continue`)
Self-quoting from our server-side implementation: https://github.com/reactphp/http/issues/109#issuecomment-278958298
Thanks for filing this ticket and sparking the discussion about our expect-continue feature (
Expect: 100-continue) :+1:First things first, here's how this works in the first place:
- This feature is specified as part of HTTP/1.1: https://tools.ietf.org/html/rfc7231#section-5.1.1
- Clients MAY implement this feature but are not required to do so
- Severs MAY implement this feature but are not required to do so
- If the client includes a
Expect: 100-continueheader, the server MAY return an intermediaryHTTP/1.1 100 Continueresponse after receiving the request headers, which causes the client to start transmitting the actual message body- If the client includes a
Expect: 100-continueheader, the server MAY reject the request with any "normal" error response message, which means the client never has to transmit the message body at all- Clients MUST support servers that do not implement this feature. This usually adds a few seconds of delay where the client waits for the intermediary
HTTP/1.1 100 Continueresponse- Many common clients actually implement this feature when sending large requests only (usually a few KiB or MiB)
This means that it makes sense to automatically use this for certain requests, but we should probably provide an option to turn this off.