28
static int curl_session_count;
29
static int max_requests = -1;
30
static CURLM *curlm;
31
-#ifndef NO_CURL_EASY_DUPHANDLE
31
static CURL *curl_default;
33
-#endif
32
33
#define PREV_BUF_SIZE 4096
34
438
439
credential_fill(&http_auth);
440
443
-#if LIBCURL_VERSION_NUM >= 0x071301
441
curl_easy_setopt(result, CURLOPT_USERNAME, http_auth.username);
442
curl_easy_setopt(result, CURLOPT_PASSWORD, http_auth.password);
446
-#else
447
- {
448
- static struct strbuf up = STRBUF_INIT;
449
- /*
450
- * Note that we assume we only ever have a single set of
451
- * credentials in a given program run, so we do not have
452
- * to worry about updating this buffer, only setting its
453
- * initial value.
454
- */
455
- if (!up.len)
456
- strbuf_addf(&up, "%s:%s",
457
- http_auth.username, http_auth.password);
458
- curl_easy_setopt(result, CURLOPT_USERPWD, up.buf);
459
- }
460
-#endif
443
}
444
445
/* *var must be free-able */
453
454
static void set_proxyauth_name_password(CURL *result)
455
{
474
-#if LIBCURL_VERSION_NUM >= 0x071301
456
curl_easy_setopt(result, CURLOPT_PROXYUSERNAME,
457
proxy_auth.username);
458
curl_easy_setopt(result, CURLOPT_PROXYPASSWORD,
459
proxy_auth.password);
479
-#else
480
- struct strbuf s = STRBUF_INIT;
481
-
482
- strbuf_addstr_urlencode(&s, proxy_auth.username,
483
- is_rfc3986_unreserved);
484
- strbuf_addch(&s, ':');
485
- strbuf_addstr_urlencode(&s, proxy_auth.password,
486
- is_rfc3986_unreserved);
487
- curl_proxyuserpwd = strbuf_detach(&s, NULL);
488
- curl_easy_setopt(result, CURLOPT_PROXYUSERPWD, curl_proxyuserpwd);
489
-#endif
460
}
461
462
static void init_curl_proxy_auth(CURL *result)
718
curl_easy_setopt(handle, CURLOPT_DEBUGDATA, NULL);
719
}
720
751
-#ifdef CURLPROTO_HTTP
721
static long get_curl_allowed_protocols(int from_user)
722
{
723
long allowed_protocols = 0;
733
734
return allowed_protocols;
735
}
767
-#endif
736
737
#if LIBCURL_VERSION_NUM >=0x072f00
738
static int get_curl_http_version_opt(const char *version_string, long *opt)
874
}
875
876
curl_easy_setopt(result, CURLOPT_MAXREDIRS, 20);
909
-#if LIBCURL_VERSION_NUM >= 0x071301
877
curl_easy_setopt(result, CURLOPT_POSTREDIR, CURL_REDIR_POST_ALL);
911
-#elif LIBCURL_VERSION_NUM >= 0x071101
912
- curl_easy_setopt(result, CURLOPT_POST301, 1);
913
-#endif
914
-#ifdef CURLPROTO_HTTP
878
curl_easy_setopt(result, CURLOPT_REDIR_PROTOCOLS,
879
get_curl_allowed_protocols(0));
880
curl_easy_setopt(result, CURLOPT_PROTOCOLS,
881
get_curl_allowed_protocols(-1));
919
-#else
920
- warning(_("Protocol restrictions not supported with cURL < 7.19.4"));
921
-#endif
882
if (getenv("GIT_CURL_VERBOSE"))
883
http_trace_curl_no_data();
884
setup_curl_trace(result);
972
die("Invalid proxy URL '%s'", curl_http_proxy);
973
974
curl_easy_setopt(result, CURLOPT_PROXY, proxy_auth.host);
1015
-#if LIBCURL_VERSION_NUM >= 0x071304
975
var_override(&curl_no_proxy, getenv("NO_PROXY"));
976
var_override(&curl_no_proxy, getenv("no_proxy"));
977
curl_easy_setopt(result, CURLOPT_NOPROXY, curl_no_proxy);
1019
-#endif
978
}
979
init_curl_proxy_auth(result);
980
1105
ssl_cert_password_required = 1;
1106
}
1107
1150
-#ifndef NO_CURL_EASY_DUPHANDLE
1108
curl_default = get_curl_handle();
1152
-#endif
1109
}
1110
1111
void http_cleanup(void)
1123
}
1124
active_queue_head = NULL;
1125
1170
-#ifndef NO_CURL_EASY_DUPHANDLE
1126
curl_easy_cleanup(curl_default);
1172
-#endif
1127
1128
curl_multi_cleanup(curlm);
1129
curl_global_cleanup();
1202
}
1203
1204
if (slot->curl == NULL) {
1251
-#ifdef NO_CURL_EASY_DUPHANDLE
1252
- slot->curl = get_curl_handle();
1253
-#else
1205
slot->curl = curl_easy_duphandle(curl_default);
1255
-#endif
1206
curl_session_count++;
1207
}
1208