Thread (50 messages) flat view 50 messages, 6 authors, 2018-08-04

Re: [PATCH v7 1/2] http-backend: respect CONTENT_LENGTH as specified by rfc3875

From: Jeff King <hidden>
Date: 2018-06-04 03:44:07

On Sun, Jun 03, 2018 at 12:27:48AM +0300, Max Kirillov wrote:
http-backend reads whole input until EOF. However, the RFC 3875 specifies
that a script must read only as many bytes as specified by CONTENT_LENGTH
environment variable. Web server may exercise the specification by not closing
the script's standard input after writing content. In that case http-backend
would hang waiting for the input. The issue is known to happen with
IIS/Windows, for example.

Make http-backend read only CONTENT_LENGTH bytes, if it's defined, rather than
the whole input until EOF. If the variable is not defined, keep older behavior
of reading until EOF because it is used to support chunked transfer-encoding.

Signed-off-by: Florian Manschwetus <redacted>
[mk: fixed trivial build failures and polished style issues]
Helped-by: Junio C Hamano [off-list ref]
Signed-off-by: Max Kirillov <redacted>
---
 config.c       |  2 +-
 config.h       |  1 +
 http-backend.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 44 insertions(+), 2 deletions(-)
This first patch looks good to me, though it may be worth mentioning in
the commit message that we're only handling the buffered-input side here
(that is obvious to anybody reading this whole series now, but it may
help out people digging in the history later).

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help