git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] http-backend: treat empty CONTENT_LENGTH as zero

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Sep 12, 2018, 06:26 UTC
Message-ID
<20180912062648.GA197819@aiede.svl.corp.google.com>
In-Reply-To
<20180912055626.GA13642@sigill.intra.peff.net>
Jeff King wrote:
> On Tue, Sep 11, 2018 at 11:15:13AM -0700, Junio C Hamano wrote:
Show 8 quoted lines
>> I do not think we would mind terribly if we do not support
>> combinations like gzipped-and-then-chunked from day one.  An in-code
>> NEEDSWORK comment that refers to the production in RFC 2616 Page 143
>> may not hurt, though.
>
> It's pretty common for Git to send gzip'd contents, so this might
> actually be necessary on day one. However, it looks like we do so by
> setting the content-encoding header.
Correct, we haven't been using Transfer-Encoding for that.
Show 5 quoted lines
> I really wonder if this topic is worth pursuing further without finding
> a real-world case that actually fails with the v2.19 code. I.e., is
> there actually a server that doesn't set CONTENT_LENGTH and really can't
> handle read-to-eof? It's plausible to me, but it's also equally
> plausible that we'd be breaking some other case.

I wonder about the motivating IIS case. The CGI spec says that CONTENT_LENGTH is set if and only if the message has a message-body. When discussing message-body, it says

      Request-Data   = [ request-body ] [ extension-data ]
[...]
   A request-body is supplied with the request if the CONTENT_LENGTH is
   not NULL.  The server MUST make at least that many bytes available
   for the script to read.  The server MAY signal an end-of-file
   condition after CONTENT_LENGTH bytes have been read or it MAY supply
   extension data.  Therefore, the script MUST NOT attempt to read more
   than CONTENT_LENGTH bytes, even if more data is available.

Does that mean that if CONTENT_LENGTH is not set, then we are guaranteed to see EOF, because extension-data cannot be present? If so, then what we have in v2.19 (plus Max's test improvement that is in "next") is already enough.

So I agree.
 1. Junio, please eject this patch from "pu", since we don't have any
    need for it.
 2. IIS users, please test v2.19 and let us know how it goes.

Do we have any scenarios that would use an empty POST (or other non-GET) request?

Thanks, Jonathan

Previous: Jeff KingNext: Junio C Hamano
Message 36 of 39 in “Re: CONTENT_LENGTH can no longer be empty”
  1. Jonathan NiederSep 6, 2018
  2. http-backend: allow empty CONTENT_LENGTHMax Kirillov, Sep 6, 2018
  3. Junio C HamanoSep 6, 2018
  4. Max KirillovSep 7, 2018
  5. Jeff KingSep 7, 2018
  6. Max KirillovSep 7, 2018
  7. Max KirillovSep 7, 2018
  8. Junio C HamanoSep 7, 2018
  9. Max KirillovSep 8, 2018
  10. Max KirillovSep 9, 2018
  11. Jonathan NiederSep 6, 2018
  12. http-backend: allow empty CONTENT_LENGTHMax Kirillov, Sep 7, 2018
  13. Jonathan NiederSep 8, 2018
  14. http-backend: allow empty CONTENT_LENGTHMax Kirillov, Sep 8, 2018
  15. Jonathan NiederSep 10, 2018
  16. Max KirillovSep 10, 2018
  17. Jonathan NiederSep 11, 2018
  18. http-backend test: make empty CONTENT_LENGTH test more realisticMax Kirillov, Sep 11, 2018
  19. http-backend: allow empty CONTENT_LENGTHMax Kirillov, Sep 8, 2018
  20. http-backend: allow empty CONTENT_LENGTHMax Kirillov, Sep 9, 2018
  21. Jonathan NiederSep 10, 2018
  22. Jeff KingSep 10, 2018
  23. Junio C HamanoSep 10, 2018
  24. Jeff KingSep 10, 2018
  25. http-backend: Treat empty CONTENT_LENGTH as zeroMax Kirillov, Sep 10, 2018
  26. Jonathan NiederSep 10, 2018
  27. Jeff KingSep 11, 2018
  28. Jonathan NiederSep 11, 2018
  29. Jeff KingSep 11, 2018
  30. Jeff KingSep 11, 2018
  31. http-backend: treat empty CONTENT_LENGTH as zeroJonathan Nieder, Sep 11, 2018
  32. Jonathan NiederSep 11, 2018
  33. Junio C HamanoSep 11, 2018
  34. Junio C HamanoSep 11, 2018
  35. Jeff KingSep 12, 2018
  36. Jonathan NiederSep 12, 2018
  37. Junio C HamanoSep 12, 2018
  38. Junio C HamanoSep 11, 2018
  39. Jonathan NiederSep 11, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.