summaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-09-09 14:32:08 -0700
committerJunio C Hamano <gitster@pobox.com>2013-09-09 14:32:08 -0700
commit43012626401421c19e3fd211c27672890986f6b9 (patch)
treec0697fd48b53b18b163720982f9b359421cacce1 /http.c
parent2233ad4534db8a37b1bf726312d52d4a0a51db0a (diff)
parent580cf0a02ee15045a02c8ffefca646bbb0b1e953 (diff)
downloadgit-43012626401421c19e3fd211c27672890986f6b9.tar.gz
Merge branch 'db/http-savecookies'
* db/http-savecookies: t5551: Remove header from curl cookie file http: add http.savecookies option to write out HTTP cookies
Diffstat (limited to 'http.c')
-rw-r--r--http.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/http.c b/http.c
index 2d086aedfa..2fbf986231 100644
--- a/http.c
+++ b/http.c
@@ -45,6 +45,7 @@ static long curl_low_speed_time = -1;
static int curl_ftp_no_epsv;
static const char *curl_http_proxy;
static const char *curl_cookie_file;
+static int curl_save_cookies;
static struct credential http_auth = CREDENTIAL_INIT;
static int http_proactive_auth;
static const char *user_agent;
@@ -200,6 +201,10 @@ static int http_options(const char *var, const char *value, void *cb)
if (!strcmp("http.cookiefile", var))
return git_config_string(&curl_cookie_file, var, value);
+ if (!strcmp("http.savecookies", var)) {
+ curl_save_cookies = git_config_bool(var, value);
+ return 0;
+ }
if (!strcmp("http.postbuffer", var)) {
http_post_buffer = git_config_int(var, value);
@@ -513,6 +518,8 @@ struct active_request_slot *get_active_slot(void)
slot->callback_data = NULL;
slot->callback_func = NULL;
curl_easy_setopt(slot->curl, CURLOPT_COOKIEFILE, curl_cookie_file);
+ if (curl_save_cookies)
+ curl_easy_setopt(slot->curl, CURLOPT_COOKIEJAR, curl_cookie_file);
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, pragma_header);
curl_easy_setopt(slot->curl, CURLOPT_ERRORBUFFER, curl_errorstr);
curl_easy_setopt(slot->curl, CURLOPT_CUSTOMREQUEST, NULL);