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

Re: [PATCH 2/2] Unset CURLOPT_FAILONERROR

From
Masaya Suzuki <masayasuzuki@google.com>
Date
Dec 28, 2018, 19:51 UTC
Message-ID
<CAJB1erXq3JZMd9XwUZFHp80Hr2kRakrp3JJgrAugXPyjp1rxNg@mail.gmail.com>
In-Reply-To
<CAPig+cQc6oF3b03XS2jmNdtUDOX_08tv=AMUpdd7D1eDto33=A@mail.gmail.com>
On Fri, Dec 28, 2018 at 11:37 AM Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 60 quoted lines
>
> On Thu, Dec 27, 2018 at 8:47 PM Masaya Suzuki <masayasuzuki@google.com> wrote:
> > When GIT_CURL_VERBOSE is set, libcurl produces request/response headers
> > to stderr. However, if the response is an error response and
> > CURLOPT_FAILONERROR is set, libcurl stops parsing the response, and it
> > won't ump the headers. Showing HTTP response headers is useful for
>
> s/ump/dump/
>
> > debugging, especially for non-OK responses.
> >
> > This is substantially same as setting http_options.keep_error to all
> > requests. Hence, removing this option.
>
> s/removing/remove/
>
> > Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
> > ---
> > diff --git a/t/t5581-http-curl-verbose.sh b/t/t5581-http-curl-verbose.sh
> > @@ -0,0 +1,32 @@
> > +test_expect_success 'setup repository' '
> > +       ...
> > +'
> > +
> > +test_expect_success 'create http-accessible bare repository' '
>
> Not a big deal, but this seems like more setup, so it could be folded
> into the "setup" test above it.
>
> > +       mkdir "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
> > +       (cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
> > +        git --bare init
> > +       ) &&
>
> Since this is a new test script, it makes sense to format the subshell
> in the modern style:
>
>     (
>         cd ... &&
>         git ...
>     ) &&
>
> Alternately, use -C and drop the subshell altogether:
>
>     git -C $BLAH/repo.git --bare init &&
>
> > +       git remote add public "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
> > +       git push public master:master
> > +'
> > +
> > +test_expect_success 'failure in git-upload-pack is shown' '
> > +       (GIT_CURL_VERBOSE=1 git clone --bare "$HTTPD_URL/error_git_upload_pack/smart/repo.git" 2>curl_log ||
> > +        true) &&
>
> Using test_might_fail() would allow you to drop the subshell and the "|| true":
>
>     test_might_fail env GIT_CURL_VERBOSE=1  git clone ... &&
>
> > +       cat curl_log | grep "< HTTP/1.1 500 Intentional Breakage"
> > +'

The test should success. This is a test that a log is produced after a git command fails. The point of this test is "cat curl_log | grep ..." part that asserts the log.

Previous: Eric SunshineNext: Eric Sunshine
Message 4 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.