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

Re: [PATCH v3 1/5] http: support file handles for HTTP_KEEP_ERROR

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Jan 9, 2019, 12:15 UTC
Message-ID
<20190109121555.GE4673@szeder.dev>
In-Reply-To
<20190108024741.62176-2-masayasuzuki@google.com>
On Mon, Jan 07, 2019 at 06:47:37PM -0800, Masaya Suzuki wrote:
Show 29 quoted lines
> HTTP_KEEP_ERROR makes it easy to debug HTTP transport errors. In order
> to make HTTP_KEEP_ERROR enabled for all requests, file handles need to
> be supported.
> 
> Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
> ---
>  http.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/http.c b/http.c
> index 0b6807cef9..06450da96e 100644
> --- a/http.c
> +++ b/http.c
> @@ -1991,16 +1991,19 @@ static int http_request_reauth(const char *url,
>  	/*
>  	 * If we are using KEEP_ERROR, the previous request may have
>  	 * put cruft into our output stream; we should clear it out before
> -	 * making our next request. We only know how to do this for
> -	 * the strbuf case, but that is enough to satisfy current callers.
> +	 * making our next request.
>  	 */
>  	if (options && options->keep_error) {
>  		switch (target) {
>  		case HTTP_REQUEST_STRBUF:
>  			strbuf_reset(result);
>  			break;
> +		case HTTP_REQUEST_FILE:
> +			fflush(result);
> +			ftruncate(fileno(result), 0);
Some GCC versions complain about the above line:
  http.c: In function ‘http_request_reauth’:
  http.c:1961:3: error: ignoring return value of ‘ftruncate’, declared with attribute warn_unused_result [-Werror=unused-result]
     ftruncate(fileno(result), 0);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      CC shell.o
      CC remote-testsvn.o
      CC vcs-svn/line_buffer.o
  cc1: all warnings being treated as errors
  make: *** [http.o] Error 1
  make: *** Waiting for unfinished jobs....
Show 10 quoted lines
> +			break;
>  		default:
> -			BUG("HTTP_KEEP_ERROR is only supported with strbufs");
> +			BUG("Unknown http_request target");
>  		}
>  	}
>  
> -- 
> 2.20.1.97.g81188d93c3-goog
> 
Previous: Masaya SuzukiNext: Masaya Suzuki
Message 18 of 29 in “Change how HTTP response body is returned”
  1. 1/2 Change how HTTP response body is returnedMasaya Suzuki, Dec 28, 2018
  2. 2/2 Unset CURLOPT_FAILONERRORMasaya Suzuki, Dec 28, 2018
  3. Eric SunshineDec 28, 2018
  4. Masaya SuzukiDec 28, 2018
  5. Eric SunshineDec 28, 2018
  6. Masaya SuzukiDec 28, 2018
  7. 0/2 Show HTTP headers of failed requests with GIT_CURL_VERBOSEMasaya Suzuki, Dec 29, 2018
  8. 1/2 Change how HTTP response body is returnedMasaya Suzuki, Dec 29, 2018
  9. Junio C HamanoJan 3, 2019
  10. Jeff KingJan 4, 2019
  11. Junio C HamanoJan 4, 2019
  12. Jeff KingJan 4, 2019
  13. 2/2 Unset CURLOPT_FAILONERRORMasaya Suzuki, Dec 29, 2018
  14. Jeff KingJan 4, 2019
  15. Masaya SuzukiJan 7, 2019
  16. 0/5 Show HTTP headers of failed requests with GIT_CURL_VERBOSEMasaya Suzuki, Jan 8, 2019
  17. 1/5 http: support file handles for HTTP_KEEP_ERRORMasaya Suzuki, Jan 8, 2019
  18. SZEDER GáborJan 9, 2019
  19. 2/5 http: enable keep_error for HTTP requestsMasaya Suzuki, Jan 8, 2019
  20. 3/5 remote-curl: define struct for CURLOPT_WRITEFUNCTIONMasaya Suzuki, Jan 8, 2019
  21. 4/5 remote-curl: unset CURLOPT_FAILONERRORMasaya Suzuki, Jan 8, 2019
  22. 5/5 test: test GIT_CURL_VERBOSE=1 shows an errorMasaya Suzuki, Jan 8, 2019
  23. 0/5 Show HTTP headers of failed requests with GIT_CURL_VERBOSEMasaya Suzuki, Jan 10, 2019
  24. 1/5 http: support file handles for HTTP_KEEP_ERRORMasaya Suzuki, Jan 10, 2019
  25. 2/5 http: enable keep_error for HTTP requestsMasaya Suzuki, Jan 10, 2019
  26. 3/5 remote-curl: define struct for CURLOPT_WRITEFUNCTIONMasaya Suzuki, Jan 10, 2019
  27. 4/5 remote-curl: unset CURLOPT_FAILONERRORMasaya Suzuki, Jan 10, 2019
  28. 5/5 test: test GIT_CURL_VERBOSE=1 shows an errorMasaya Suzuki, Jan 10, 2019
  29. Junio C HamanoJan 10, 2019

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.