Re: [PATCH v2 1/2] Change how HTTP response body is returned

2019-01-04 Thread Junio C Hamano
Jeff King writes: > The most robust thing would perhaps be: > > fflush(dest->file); > ftruncate(fileno(dest->file), 0); > > which leaves the handle intact. An added benefit of that approach is that there is no need for the filename field in the dest structure. Having a separate filename fie

Re: [PATCH v2 1/2] Change how HTTP response body is returned

2019-01-04 Thread Jeff King
On Sat, Dec 29, 2018 at 11:44:46AM -0800, Masaya Suzuki wrote: > +/* > + * A callback for CURLOPT_WRITEFUNCTION. The return value is the bytes > consumed > + * from ptr. > + */ > static size_t rpc_in(char *ptr, size_t eltsize, > size_t nmemb, void *buffer_) > { > size_t size

Re: [PATCH v2 1/2] Change how HTTP response body is returned

2019-01-04 Thread Jeff King
On Thu, Jan 03, 2019 at 11:09:02AM -0800, Junio C Hamano wrote: > > + if (dest->file) { > > + /* > > +* At this point, the file contains the response body of the > > +* previous request. We need to truncate the file. > > +*/ > > + FILE *new

Re: [PATCH v2 1/2] Change how HTTP response body is returned

2019-01-03 Thread Junio C Hamano
Masaya Suzuki writes: > Subject: Re: [PATCH v2 1/2] Change how HTTP response body is returned Perhaps: Subject: http: change the way response body is returned but if we can state why we want to do so concisely, that would be even better. > This changes the way HTTP response b

[PATCH v2 1/2] Change how HTTP response body is returned

2018-12-29 Thread Masaya Suzuki
This changes the way HTTP response body is returned in http_request_reauth and post_rpc. 1. http_request_reauth makes up to two requests; one without a credential and one with a credential. The first request can fail if it needs a credential. When the keep_error option is specified, the r