- From: Kazuho Oku <kazuhooku@gmail.com>
- Date: Thu, 15 Sep 2016 06:17:16 +0900
- To: HTTP Working Group <ietf-http-wg@w3.org>
Hi, Is there any way for a H2 server to distinguish between a request without a body and a request with 0-byte body? In HTTP/1, the distinction has been possible by looking for a content-length or a transfer-encoding header. And H1 applications have been actually looking for the headers to see if a request is accompanied by a body by checking the existence of these headers. OTOH, HTTP/2 does not seem to provide a method to distinguish between the two. A HTTP/2 client is allowed to send a request accompanied by a body without using the content-length header. It is also allowed to send a HEADERS frame with END_STREAM flag set in case the size of the body is zero-byte, omitting the DATA frame. In such case, a request with zero-byte body becomes indistinguishable from a request without a body. The fact becomes an issue when we need to transcode a HTTP/2 request to a HTTP/1 request (e.g. when a H2 proxy transmits a request to an H1 server running upstream), because, some applications try to see if a POST request is accompanied by a body by checking the existence of content-length or transfer-encoding header, or to assert that a GET request is _not_ accompanied by a body by checking the non-existence of the headers. As a mitigation, it is certainly possible for a H2 proxy transcoding to H1 to use the method of the request to see if content-length or transfer-encoding header should be set in such case. But my understanding is that generally speaking in HTTP whether if a request is accompanied by a body is orthogonal to which method is being used. Could somebody clarify what I am missing, or provide a method I should use to accommodate the issue? -- Kazuho Oku
Received on Wednesday, 14 September 2016 21:17:45 UTC