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

[RFC PATCH 3/3] t5551-http-fetch: Work around broken Accept header in libcurl

From
Shawn O. Pearce <spearce@spearce.org>
Date
Nov 9, 2009, 18:10 UTC
Message-ID
<1257790237-30850-3-git-send-email-spearce@spearce.org>
In-Reply-To
<1257790237-30850-1-git-send-email-spearce@spearce.org>

Unfortunately at least one version of libcurl has a bug causing it to include "Accept: */*" in the same POST request where we have already asked for "Accept: application/x-git-upload-pack-response".

This is a bug in libcurl, not Git, or our test vector. The application has explicitly asked the server for a single content type, but libcurl has mistakenly also told the server the client application will accept */*, which is any content type.

Based on the libcurl change log, this "Accept: */*" header bug may have been fixed in version 7.18.1 released March 30, 2008:

  http://curl.haxx.se/changes.html#7_18_1

Rather than require users to upgrade libcurl we change the test vector to trim this line out of the 2nd request.

Reported-by: Tarmigan <tarmigan+git@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 Actually, I don't want to apply this.
 Tarmigan, your libcurl is broken, it looks like a newer version
 fixes the problem, so I would suggest upgrading it.
 t/t5551-http-fetch.sh |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/t/t5551-http-fetch.sh b/t/t5551-http-fetch.sh
index 6b0165c..9d59065 100755
--- a/t/t5551-http-fetch.sh
+++ b/t/t5551-http-fetch.sh
@@ -61,6 +61,9 @@ test_expect_success 'clone http repository' '
 
 		/^> User-Agent: /d
 		/^> Host: /d
+		/^> POST /,$ {
+			/^> Accept: [*]\\/[*]/d
+		}
 		s/^> Content-Length: .*/> Content-Length: xxx/
 		/^00..want /d
 		/^00.*done/d
-- 
1.6.5.2.351.g09432
Previous: TarmiganNext: Tarmigan
Message 4 of 5 in “http-backend: Fix symbol clash on AIX 5.3”
  1. 1/3 http-backend: Fix symbol clash on AIX 5.3Shawn O. Pearce, Nov 9, 2009
  2. 2/3 t5551-http-fetch: Work around some libcurl versionsShawn O. Pearce, Nov 9, 2009
  3. TarmiganNov 9, 2009
  4. 3/3 t5551-http-fetch: Work around broken Accept header in libcurlShawn O. Pearce, Nov 9, 2009
  5. TarmiganNov 9, 2009

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.