summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2011-06-29 17:03:12 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2011-06-29 17:03:12 -0700
commit187e902dd25da5a9f48f35a48e6281faa2f8ac39 (patch)
tree116dd729b9883c9de4100c1e6beabdd90cc05cab
parentMerge branch 'jk/maint-1.7.2-status-ignored' (diff)
parenthttp: pass http.cookiefile using CURLOPT_COOKIEFILE (diff)
downloadtgif-187e902dd25da5a9f48f35a48e6281faa2f8ac39.tar.xz
Merge branch 'db/http-cookies'
* db/http-cookies: http: pass http.cookiefile using CURLOPT_COOKIEFILE
-rw-r--r--Documentation/config.txt8
-rw-r--r--http.c5
2 files changed, 13 insertions, 0 deletions
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 6b93777199..c631d1cbf9 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1196,6 +1196,14 @@ http.proxy::
environment variable (see linkgit:curl[1]). This can be overridden
on a per-remote basis; see remote.<name>.proxy
+http.cookiefile::
+ File containing previously stored cookie lines which should be used
+ in the git http session, if they match the server. The file format
+ of the file to read cookies from should be plain HTTP headers or
+ the Netscape/Mozilla cookie file format (see linkgit:curl[1]).
+ NOTE that the file specified with http.cookiefile is only used as
+ input. No cookies will be stored in the file.
+
http.sslVerify::
Whether to verify the SSL certificate when fetching or pushing
over HTTPS. Can be overridden by the 'GIT_SSL_NO_VERIFY' environment
diff --git a/http.c b/http.c
index b2ae8de16d..a1ea3db499 100644
--- a/http.c
+++ b/http.c
@@ -41,6 +41,7 @@ static long curl_low_speed_limit = -1;
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 char *user_name, *user_pass;
static const char *user_agent;
@@ -191,6 +192,9 @@ static int http_options(const char *var, const char *value, void *cb)
if (!strcmp("http.proxy", var))
return git_config_string(&curl_http_proxy, var, value);
+ if (!strcmp("http.cookiefile", var))
+ return git_config_string(&curl_cookie_file, var, value);
+
if (!strcmp("http.postbuffer", var)) {
http_post_buffer = git_config_int(var, value);
if (http_post_buffer < LARGE_PACKET_MAX)
@@ -531,6 +535,7 @@ struct active_request_slot *get_active_slot(void)
slot->finished = NULL;
slot->callback_data = NULL;
slot->callback_func = NULL;
+ curl_easy_setopt(slot->curl, CURLOPT_COOKIEFILE, 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);