1
0
mirror of https://github.com/git/git.git synced 2024-09-08 03:50:44 +02:00

Merge branch 'jc/http-cookiefile'

The http.cookieFile and http.saveCookies configuration variables
have a few values that need to be avoided, which are now ignored
with warning messages.

* jc/http-cookiefile:
  http.c: cookie file tightening
This commit is contained in:
Junio C Hamano 2024-07-17 10:47:25 -07:00
commit dd6d10285b

9
http.c
View File

@ -1509,7 +1509,16 @@ struct active_request_slot *get_active_slot(void)
slot->finished = NULL;
slot->callback_data = NULL;
slot->callback_func = NULL;
if (curl_cookie_file && !strcmp(curl_cookie_file, "-")) {
warning(_("refusing to read cookies from http.cookiefile '-'"));
FREE_AND_NULL(curl_cookie_file);
}
curl_easy_setopt(slot->curl, CURLOPT_COOKIEFILE, curl_cookie_file);
if (curl_save_cookies && (!curl_cookie_file || !curl_cookie_file[0])) {
curl_save_cookies = 0;
warning(_("ignoring http.savecookies for empty http.cookiefile"));
}
if (curl_save_cookies)
curl_easy_setopt(slot->curl, CURLOPT_COOKIEJAR, curl_cookie_file);
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, pragma_header);