Skip to content

Commit

Permalink
Merge branch 'db/http-cookies'
Browse files Browse the repository at this point in the history
* db/http-cookies:
  http: pass http.cookiefile using CURLOPT_COOKIEFILE
  • Loading branch information
Junio C Hamano committed Jun 30, 2011
2 parents 50cebda + bcfb95d commit 187e902
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Documentation/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions http.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 187e902

Please sign in to comment.