Re: [PATCH v7 2/2] http-backend: respect CONTENT_LENGTH for receive-pack

2018-06-11 Thread Jeff King
On Mon, Jun 11, 2018 at 05:18:13AM -0400, Jeff King wrote: > > >> +sleep 1; # is interrupted by SIGCHLD > > >> +if (!$exited) { > > >> +close($out); > > >> +die "Command did not exit after reading whole body"; > > >> +} > > > > > Also, do we need to protect ourselves against

Re: [PATCH v7 2/2] http-backend: respect CONTENT_LENGTH for receive-pack

2018-06-11 Thread Jeff King
On Tue, Jun 05, 2018 at 01:18:08AM +0300, Max Kirillov wrote: > > On Sun, Jun 03, 2018 at 12:27:49AM +0300, Max Kirillov wrote: > > Since this is slightly less efficient, and because it only matters if > > the web server does not already close the pipe, should this have a > > run-time

Re: [PATCH v7 2/2] http-backend: respect CONTENT_LENGTH for receive-pack

2018-06-11 Thread Jeff King
On Sun, Jun 10, 2018 at 06:07:27PM +0300, Max Kirillov wrote: > On Mon, Jun 04, 2018 at 12:44:09AM -0400, Jeff King wrote: > > On Sun, Jun 03, 2018 at 12:27:49AM +0300, Max Kirillov wrote: > >> + env \ > >> + CONTENT_TYPE=application/x-git-upload-pack-request \ > >> +

Re: [PATCH v7 2/2] http-backend: respect CONTENT_LENGTH for receive-pack

2018-06-10 Thread Max Kirillov
On Mon, Jun 04, 2018 at 12:44:09AM -0400, Jeff King wrote: > On Sun, Jun 03, 2018 at 12:27:49AM +0300, Max Kirillov wrote: >> +env \ >> +CONTENT_TYPE=application/x-git-upload-pack-request \ >> +QUERY_STRING=/repo.git/git-upload-pack \ >> +

Re: [PATCH v7 2/2] http-backend: respect CONTENT_LENGTH for receive-pack

2018-06-10 Thread Max Kirillov
On Tue, Jun 05, 2018 at 01:18:08AM +0300, Max Kirillov wrote: > On Mon, Jun 04, 2018 at 12:44:09AM -0400, Jeff King wrote: >> Since this is slightly less efficient, and because it only matters if >> the web server does not already close the pipe, should this have a >> run-time configuration knob,

Re: [PATCH v7 2/2] http-backend: respect CONTENT_LENGTH for receive-pack

2018-06-04 Thread Ramsay Jones
On 04/06/18 18:06, Max Kirillov wrote: > On Mon, Jun 04, 2018 at 01:31:58PM +0900, Junio C Hamano wrote: >> Max Kirillov writes: >>> + size_t n = xread(0, buf, chunk_length); >>> + if (n < 0) >>> + die_errno("Reading request failed"); >> >> n that is of

Re: [PATCH v7 2/2] http-backend: respect CONTENT_LENGTH for receive-pack

2018-06-04 Thread Max Kirillov
On Mon, Jun 04, 2018 at 12:44:09AM -0400, Jeff King wrote: Thanks for the comments, I will do the things you proposed, or try to and get back later if there are any issues. Some notes below. > On Sun, Jun 03, 2018 at 12:27:49AM +0300, Max Kirillov wrote: > Since this is slightly less efficient,

Re: [PATCH v7 2/2] http-backend: respect CONTENT_LENGTH for receive-pack

2018-06-04 Thread Max Kirillov
On Mon, Jun 04, 2018 at 01:31:58PM +0900, Junio C Hamano wrote: > Max Kirillov writes: >> +size_t n = xread(0, buf, chunk_length); >> +if (n < 0) >> +die_errno("Reading request failed"); > > n that is of type size_t is unsigned and cannot be negative

Re: [PATCH v7 2/2] http-backend: respect CONTENT_LENGTH for receive-pack

2018-06-03 Thread Jeff King
On Sun, Jun 03, 2018 at 12:27:49AM +0300, Max Kirillov wrote: > Push passes to another commands, as described in > https://public-inbox.org/git/20171129032214.gb32...@sigill.intra.peff.net/ > > As it gets complicated to correctly track the data length, instead transfer > the data through parent

Re: [PATCH v7 2/2] http-backend: respect CONTENT_LENGTH for receive-pack

2018-06-03 Thread Junio C Hamano
Max Kirillov writes: > +static void pipe_fixed_length(const char *prog_name, int out, size_t req_len) > +{ > + unsigned char buf[8192]; > + size_t remaining_len = req_len; > + > + while (remaining_len > 0) { > + size_t chunk_length = remaining_len > sizeof(buf) ?

[PATCH v7 2/2] http-backend: respect CONTENT_LENGTH for receive-pack

2018-06-02 Thread Max Kirillov
Push passes to another commands, as described in https://public-inbox.org/git/20171129032214.gb32...@sigill.intra.peff.net/ As it gets complicated to correctly track the data length, instead transfer the data through parent process and cut the pipe as the specified length is reached. Do it only