summaryrefslogtreecommitdiff
path: root/t/t5551-http-fetch.sh
diff options
context:
space:
mode:
authorDave Borowitz <dborowitz@google.com>2013-07-23 15:40:17 -0700
committerJunio C Hamano <gitster@pobox.com>2013-07-30 09:19:04 -0700
commit912b2acf2f376e51bee32a486ca42ba4ad764363 (patch)
tree2134222302181c560806055f855e11d2b9fc56b1 /t/t5551-http-fetch.sh
parent6a907786af835ac15962be53f1492f23e044f479 (diff)
downloadgit-912b2acf2f376e51bee32a486ca42ba4ad764363.tar.gz
http: add http.savecookies option to write out HTTP cookies
HTTP servers may send Set-Cookie headers in a response and expect them to be set on subsequent requests. By default, libcurl behavior is to store such cookies in memory and reuse them across requests within a single session. However, it may also make sense, depending on the server and the cookies, to store them across sessions. Provide users an option to enable this behavior, writing cookies out to the same file specified in http.cookiefile. Signed-off-by: Dave Borowitz <dborowitz@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5551-http-fetch.sh')
-rwxr-xr-xt/t5551-http-fetch.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/t/t5551-http-fetch.sh b/t/t5551-http-fetch.sh
index 55a866af80..287d22b510 100755
--- a/t/t5551-http-fetch.sh
+++ b/t/t5551-http-fetch.sh
@@ -187,6 +187,24 @@ test_expect_success 'dumb clone via http-backend respects namespace' '
test_cmp expect actual
'
+cat >cookies.txt <<EOF
+127.0.0.1 FALSE /smart_cookies/ FALSE 0 othername othervalue
+EOF
+cat >expect_cookies.txt <<EOF
+# Netscape HTTP Cookie File
+# http://curl.haxx.se/docs/http-cookies.html
+# This file was generated by libcurl! Edit at your own risk.
+
+127.0.0.1 FALSE /smart_cookies/ FALSE 0 othername othervalue
+127.0.0.1 FALSE /smart_cookies/repo.git/info/ FALSE 0 name value
+EOF
+test_expect_success 'cookies stored in http.cookiefile when http.savecookies set' '
+ git config http.cookiefile cookies.txt &&
+ git config http.savecookies true &&
+ git ls-remote $HTTPD_URL/smart_cookies/repo.git master &&
+ test_cmp expect_cookies.txt cookies.txt
+'
+
test -n "$GIT_TEST_LONG" && test_set_prereq EXPENSIVE
test_expect_success EXPENSIVE 'create 50,000 tags in the repo' '