summaryrefslogtreecommitdiff
path: root/t/t5551-http-fetch.sh
diff options
context:
space:
mode:
authorLibravatar Shawn Pearce <spearce@spearce.org>2013-01-31 13:02:07 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-02-04 10:22:36 -0800
commit4656bf47fca857df51b5d6f4b7b052192b3b2317 (patch)
tree91e4d6cf951f2964de99d454ec89e426753ac453 /t/t5551-http-fetch.sh
parentMerge branch 'tb/t0050-maint' into maint (diff)
downloadtgif-4656bf47fca857df51b5d6f4b7b052192b3b2317.tar.xz
Verify Content-Type from smart HTTP servers
Before parsing a suspected smart-HTTP response verify the returned Content-Type matches the standard. This protects a client from attempting to process a payload that smells like a smart-HTTP server response. JGit has been doing this check on all responses since the dawn of time. I mistakenly failed to include it in git-core when smart HTTP was introduced. At the time I didn't know how to get the Content-Type from libcurl. I punted, meant to circle back and fix this, and just plain forgot about it. Signed-off-by: Shawn Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5551-http-fetch.sh')
-rwxr-xr-xt/t5551-http-fetch.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/t/t5551-http-fetch.sh b/t/t5551-http-fetch.sh
index c5cd2e348c..cb95b953b7 100755
--- a/t/t5551-http-fetch.sh
+++ b/t/t5551-http-fetch.sh
@@ -157,6 +157,12 @@ test_expect_success 'GIT_SMART_HTTP can disable smart http' '
test_must_fail git fetch)
'
+test_expect_success 'invalid Content-Type rejected' '
+ echo "fatal: invalid content-type text/html" >expect
+ test_must_fail git clone $HTTPD_URL/broken_smart/repo.git 2>actual
+ test_cmp expect actual
+'
+
test -n "$GIT_TEST_LONG" && test_set_prereq EXPENSIVE
test_expect_success EXPENSIVE 'create 50,000 tags in the repo' '