diff options
author | Jeff King <peff@peff.net> | 2014-05-22 05:29:47 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-05-27 09:57:00 -0700 |
commit | bf197fd7eebcb3579dd659af35822ce88adc66c8 (patch) | |
tree | 746ca7087ca1a5e48a30a20262e831ce2f83c426 /t/t5550-http-fetch-dumb.sh | |
parent | dbcf2bd3dec1244fdbafb3ec7312ed14d83c0025 (diff) | |
download | git-bf197fd7eebcb3579dd659af35822ce88adc66c8.tar.gz |
http: extract type/subtype portion of content-type
When we get a content-type from curl, we get the whole
header line, including any parameters, and without any
normalization (like downcasing or whitespace) applied.
If we later try to match it with strcmp() or even
strcasecmp(), we may get false negatives.
This could cause two visible behaviors:
1. We might fail to recognize a smart-http server by its
content-type.
2. We might fail to relay text/plain error messages to
users (especially if they contain a charset parameter).
This patch teaches the http code to extract and normalize
just the type/subtype portion of the string. This is
technically passing out less information to the callers, who
can no longer see the parameters. But none of the current
callers cares, and a future patch will add back an
easier-to-use method for accessing those parameters.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5550-http-fetch-dumb.sh')
-rwxr-xr-x | t/t5550-http-fetch-dumb.sh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh index 13defd3886..b35b2610e3 100755 --- a/t/t5550-http-fetch-dumb.sh +++ b/t/t5550-http-fetch-dumb.sh @@ -181,5 +181,10 @@ test_expect_success 'git client does not show html errors' ' ! grep "this is the error message" stderr ' +test_expect_success 'git client shows text/plain with a charset' ' + test_must_fail git clone "$HTTPD_URL/error/charset" 2>stderr && + grep "this is the error message" stderr +' + stop_httpd test_done |