summaryrefslogtreecommitdiff
path: root/t/t5551-http-fetch.sh
diff options
context:
space:
mode:
authorTay Ray Chuan <rctay89@gmail.com>2010-09-25 04:20:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-09-27 18:38:55 (GMT)
commit311e2ea0062bf09d6f78f5458eeb14dbc6c092ea (patch)
treeaad14c493b580b807e33e37edcde91c2fb2b3bc8 /t/t5551-http-fetch.sh
parent9027fa9eb7df606b6658dd48a40bb993ce222ddd (diff)
downloadgit-311e2ea0062bf09d6f78f5458eeb14dbc6c092ea.zip
git-311e2ea0062bf09d6f78f5458eeb14dbc6c092ea.tar.gz
git-311e2ea0062bf09d6f78f5458eeb14dbc6c092ea.tar.bz2
smart-http: Don't change POST to GET when following redirect
For a long time (29508e1 "Isolate shared HTTP request functionality", Fri Nov 18 11:02:58 2005), we've followed HTTP redirects with CURLOPT_FOLLOWLOCATION. However, when the remote HTTP server returns a redirect the default libcurl action is to change a POST request into a GET request while following the redirect, but the remote http backend does not expect that. Fix this by telling libcurl to always keep the request as type POST with CURLOPT_POSTREDIR. For users of libcurl older than 7.19.1, use CURLOPT_POST301 instead, which only follows 301s instead of both 301s and 302s. Signed-off-by: Andreas Schwab <schwab@linux-m68k.org> Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5551-http-fetch.sh')
-rwxr-xr-xt/t5551-http-fetch.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t5551-http-fetch.sh b/t/t5551-http-fetch.sh
index fd19121..26d3557 100755
--- a/t/t5551-http-fetch.sh
+++ b/t/t5551-http-fetch.sh
@@ -101,5 +101,13 @@ test_expect_success 'used upload-pack service' '
test_cmp exp act
'
+test_expect_success 'follow redirects (301)' '
+ git clone $HTTPD_URL/smart-redir-perm/repo.git --quiet repo-p
+'
+
+test_expect_success 'follow redirects (302)' '
+ git clone $HTTPD_URL/smart-redir-temp/repo.git --quiet repo-t
+'
+
stop_httpd
test_done