Re: [PATCH v7 1/2] http-backend: respect CONTENT_LENGTH as specified by rfc3875
- From
Jeff King <peff@peff.net>
- Date
- Jun 4, 2018, 03:44 UTC
- Message-ID
- <20180604034402.GC14451@sigill.intra.peff.net>
- In-Reply-To
- <20180602212749.21324-2-max@max630.net>
On Sun, Jun 03, 2018 at 12:27:48AM +0300, Max Kirillov wrote:
Show 20 quoted lines
> 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 <manschwetus@cs-software-gmbh.de> > [mk: fixed trivial build failures and polished style issues] > Helped-by: Junio C Hamano <gitster@pobox.com> > Signed-off-by: Max Kirillov <max@max630.net> > --- > 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