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

2018-09-12 Thread Junio C Hamano
Jeff King writes: > 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 eq

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

2018-09-11 Thread Jonathan Nieder
Jeff King wrote: > On Tue, Sep 11, 2018 at 11:15:13AM -0700, Junio C Hamano wrote: >> 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 no

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

2018-09-11 Thread Jeff King
On Tue, Sep 11, 2018 at 11:15:13AM -0700, Junio C Hamano wrote: > > That said, a quick search of codesearch.debian.net mostly finds > > examples using straight comparison, so maybe the patch is fine as-is. > > I do not think we would mind terribly if we do not support > combinations like gzipped-

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

2018-09-11 Thread Junio C Hamano
Junio C Hamano writes: >>> + /* >>> +* According to RFC 3875, an empty or missing >>> +* CONTENT_LENGTH means "no body", but RFC 3875 >>> +* precedes HTTP/1.1 and chunked encoding. Apache and >>> +* its imitators leave CONTENT_LENGTH unset

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

2018-09-11 Thread Junio C Hamano
Jonathan Nieder writes: > Kicking off the reviews: ;-) > > Jonathan Nieder wrote: > >> --- a/http-backend.c >> +++ b/http-backend.c >> @@ -350,10 +350,25 @@ static ssize_t read_request_fixed_len(int fd, ssize_t >> req_len, unsigned char **o >> >> static ssize_t get_content_length(void) > [...

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

2018-09-10 Thread Jonathan Nieder
Junio C Hamano wrote: > Jonathan Nieder writes: >> RFC 3875 (the CGI specification) explains: >> >>The CONTENT_LENGTH variable contains the size of the message-body >>attached to the request, if any, in decimal number of octets. If no >>data is attached, then NULL (or unset). [...] >

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

2018-09-10 Thread Junio C Hamano
Jonathan Nieder writes: > RFC 3875 (the CGI specification) explains: > >The CONTENT_LENGTH variable contains the size of the message-body >attached to the request, if any, in decimal number of octets. If no >data is attached, then NULL (or unset). > > CONTENT_LENGTH = "" | 1*di

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

2018-09-10 Thread Jonathan Nieder
Kicking off the reviews: ;-) Jonathan Nieder wrote: > --- a/http-backend.c > +++ b/http-backend.c > @@ -350,10 +350,25 @@ static ssize_t read_request_fixed_len(int fd, ssize_t > req_len, unsigned char **o > > static ssize_t get_content_length(void) [...] > + /* > + *

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

2018-09-10 Thread Jonathan Nieder
As discussed in v2.19.0-rc0~45^2~2 (http-backend: respect CONTENT_LENGTH as specified by rfc3875, 2018-06-10), HTTP servers such as IIS do not close a CGI script's standard input at the end of a request, instead expecting CGI scripts to stop reading after CONTENT_LENGTH bytes. That commit taught h

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

2018-09-10 Thread Jeff King
On Mon, Sep 10, 2018 at 07:20:28PM -0700, Jonathan Nieder wrote: > Jeff King wrote: > > On Mon, Sep 10, 2018 at 02:22:21PM -0700, Jonathan Nieder wrote: > > >> Thanks. I am wondering if we should go all the way and do > >> > >>ssize_t val; > >>const char *str = getenv("CONTENT_LENGTH");

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

2018-09-10 Thread Jonathan Nieder
Jeff King wrote: > On Mon, Sep 10, 2018 at 02:22:21PM -0700, Jonathan Nieder wrote: >> Thanks. I am wondering if we should go all the way and do >> >> ssize_t val; >> const char *str = getenv("CONTENT_LENGTH"); >> >> if (!str || !*str) >> return 0; >> if (!git_par

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

2018-09-10 Thread Jeff King
On Mon, Sep 10, 2018 at 11:53:59PM +0300, Max Kirillov wrote: > From: Jeff King > Subject: [PATCH] http-backend: Treat empty CONTENT_LENGTH as zero > > There is no known case where empty body it used by a server as > instruction to read until EOF, so there is no need to violate

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

2018-09-10 Thread Jeff King
On Mon, Sep 10, 2018 at 02:22:21PM -0700, Jonathan Nieder wrote: > Thanks. I am wondering if we should go all the way and do > > ssize_t val; > const char *str = getenv("CONTENT_LENGTH"); > > if (!str || !*str) > return 0; > if (!git_parse_ssize_t(str, &val

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

2018-09-10 Thread Jonathan Nieder
Hi, Max Kirillov wrote: > From: Jeff King > Subject: [PATCH] http-backend: Treat empty CONTENT_LENGTH as zero micronit: s/Treat/treat/ > There is no known case where empty body it used by a server as > instruction to read until EOF, so there is no need to violate the

[PATCH] http-backend: Treat empty CONTENT_LENGTH as zero

2018-09-10 Thread Max Kirillov
From: Jeff King Subject: [PATCH] http-backend: Treat empty CONTENT_LENGTH as zero There is no known case where empty body it used by a server as instruction to read until EOF, so there is no need to violate the RFC. Make get_content_length() return 0 in this case. Currently there is no