-
Notifications
You must be signed in to change notification settings - Fork 593
Description
Consider a no-body OPTIONS request, as could be sent via curl:
curl -v -i -X OPTIONS -H 'Host: example.com' -H 'Access-Control-Request-Method: POST' -H 'Access-Control-Request-Headers: content-type' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: cross-site' -H 'sec-fetch-dest: empty' -H 'transfer-encoding: chunked' --http1.1 https://example.com/example
This request does satisfy the OPTIONS requirement of not having a body:
- no body (
--dataor similar) is specified in thecurlinvocation - the client, be it
curl(in this simple example), Safari or whatever else, will immediately send a chunk data size of 0.
As described in RFC9112
The chunked transfer coding is complete when a chunk with a chunk-size of zero is received, possibly followed by a trailer section, and finally terminated by an empty line.
The terminating chunk is a zero-length chunk.
As such, any application that does HEAD/OPTIONS handling will typically not attempt to read the request body when handling these methods. Unfortunately, doing complete() on this kind of a request will generate the
Sending an 2xx 'early' response before end of request for https://example.com/example received... Note that the connection will be closed after this response. Also, many clients will not read early responses! Consider only issuing this response after the request data has been completely read!
every time, essentially generating worthless warnings. Note that there is no method logged, so there is no way to workaround this by filtering away only the warnings related to HEAD/OPTIONS.