Skip to content

Commit 187e902

Browse files
committed
Merge branch 'db/http-cookies'
* db/http-cookies: http: pass http.cookiefile using CURLOPT_COOKIEFILE
2 parents 50cebda + bcfb95d commit 187e902

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Documentation/config.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,14 @@ http.proxy::
11961196
environment variable (see linkgit:curl[1]). This can be overridden
11971197
on a per-remote basis; see remote.<name>.proxy
11981198

1199+
http.cookiefile::
1200+
File containing previously stored cookie lines which should be used
1201+
in the git http session, if they match the server. The file format
1202+
of the file to read cookies from should be plain HTTP headers or
1203+
the Netscape/Mozilla cookie file format (see linkgit:curl[1]).
1204+
NOTE that the file specified with http.cookiefile is only used as
1205+
input. No cookies will be stored in the file.
1206+
11991207
http.sslVerify::
12001208
Whether to verify the SSL certificate when fetching or pushing
12011209
over HTTPS. Can be overridden by the 'GIT_SSL_NO_VERIFY' environment

http.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ static long curl_low_speed_limit = -1;
4141
static long curl_low_speed_time = -1;
4242
static int curl_ftp_no_epsv;
4343
static const char *curl_http_proxy;
44+
static const char *curl_cookie_file;
4445
static char *user_name, *user_pass;
4546
static const char *user_agent;
4647

@@ -191,6 +192,9 @@ static int http_options(const char *var, const char *value, void *cb)
191192
if (!strcmp("http.proxy", var))
192193
return git_config_string(&curl_http_proxy, var, value);
193194

195+
if (!strcmp("http.cookiefile", var))
196+
return git_config_string(&curl_cookie_file, var, value);
197+
194198
if (!strcmp("http.postbuffer", var)) {
195199
http_post_buffer = git_config_int(var, value);
196200
if (http_post_buffer < LARGE_PACKET_MAX)
@@ -531,6 +535,7 @@ struct active_request_slot *get_active_slot(void)
531535
slot->finished = NULL;
532536
slot->callback_data = NULL;
533537
slot->callback_func = NULL;
538+
curl_easy_setopt(slot->curl, CURLOPT_COOKIEFILE, curl_cookie_file);
534539
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, pragma_header);
535540
curl_easy_setopt(slot->curl, CURLOPT_ERRORBUFFER, curl_errorstr);
536541
curl_easy_setopt(slot->curl, CURLOPT_CUSTOMREQUEST, NULL);

0 commit comments

Comments
 (0)