http.c: reorder to avoid compilation failure.
Move the static function get_curl_handle() around to make sure its definition and declarations are seen by the compiler before its first use. Also remove an unused variable. Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
7b89996749
commit
11979b98ad
71
http.c
71
http.c
@ -160,6 +160,41 @@ static int http_options(const char *var, const char *value)
|
|||||||
return git_default_config(var, value);
|
return git_default_config(var, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static CURL* get_curl_handle(void)
|
||||||
|
{
|
||||||
|
CURL* result = curl_easy_init();
|
||||||
|
|
||||||
|
curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, curl_ssl_verify);
|
||||||
|
#if LIBCURL_VERSION_NUM >= 0x070907
|
||||||
|
curl_easy_setopt(result, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (ssl_cert != NULL)
|
||||||
|
curl_easy_setopt(result, CURLOPT_SSLCERT, ssl_cert);
|
||||||
|
#if LIBCURL_VERSION_NUM >= 0x070902
|
||||||
|
if (ssl_key != NULL)
|
||||||
|
curl_easy_setopt(result, CURLOPT_SSLKEY, ssl_key);
|
||||||
|
#endif
|
||||||
|
#if LIBCURL_VERSION_NUM >= 0x070908
|
||||||
|
if (ssl_capath != NULL)
|
||||||
|
curl_easy_setopt(result, CURLOPT_CAPATH, ssl_capath);
|
||||||
|
#endif
|
||||||
|
if (ssl_cainfo != NULL)
|
||||||
|
curl_easy_setopt(result, CURLOPT_CAINFO, ssl_cainfo);
|
||||||
|
curl_easy_setopt(result, CURLOPT_FAILONERROR, 1);
|
||||||
|
|
||||||
|
if (curl_low_speed_limit > 0 && curl_low_speed_time > 0) {
|
||||||
|
curl_easy_setopt(result, CURLOPT_LOW_SPEED_LIMIT,
|
||||||
|
curl_low_speed_limit);
|
||||||
|
curl_easy_setopt(result, CURLOPT_LOW_SPEED_TIME,
|
||||||
|
curl_low_speed_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
curl_easy_setopt(result, CURLOPT_FOLLOWLOCATION, 1);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void http_init(void)
|
void http_init(void)
|
||||||
{
|
{
|
||||||
char *low_speed_limit;
|
char *low_speed_limit;
|
||||||
@ -223,7 +258,6 @@ void http_cleanup(void)
|
|||||||
struct active_request_slot *slot = active_queue_head;
|
struct active_request_slot *slot = active_queue_head;
|
||||||
#ifdef USE_CURL_MULTI
|
#ifdef USE_CURL_MULTI
|
||||||
char *wait_url;
|
char *wait_url;
|
||||||
CURLMcode curlm_result;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (slot != NULL) {
|
while (slot != NULL) {
|
||||||
@ -252,41 +286,6 @@ void http_cleanup(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static CURL* get_curl_handle(void)
|
|
||||||
{
|
|
||||||
CURL* result = curl_easy_init();
|
|
||||||
|
|
||||||
curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, curl_ssl_verify);
|
|
||||||
#if LIBCURL_VERSION_NUM >= 0x070907
|
|
||||||
curl_easy_setopt(result, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (ssl_cert != NULL)
|
|
||||||
curl_easy_setopt(result, CURLOPT_SSLCERT, ssl_cert);
|
|
||||||
#if LIBCURL_VERSION_NUM >= 0x070902
|
|
||||||
if (ssl_key != NULL)
|
|
||||||
curl_easy_setopt(result, CURLOPT_SSLKEY, ssl_key);
|
|
||||||
#endif
|
|
||||||
#if LIBCURL_VERSION_NUM >= 0x070908
|
|
||||||
if (ssl_capath != NULL)
|
|
||||||
curl_easy_setopt(result, CURLOPT_CAPATH, ssl_capath);
|
|
||||||
#endif
|
|
||||||
if (ssl_cainfo != NULL)
|
|
||||||
curl_easy_setopt(result, CURLOPT_CAINFO, ssl_cainfo);
|
|
||||||
curl_easy_setopt(result, CURLOPT_FAILONERROR, 1);
|
|
||||||
|
|
||||||
if (curl_low_speed_limit > 0 && curl_low_speed_time > 0) {
|
|
||||||
curl_easy_setopt(result, CURLOPT_LOW_SPEED_LIMIT,
|
|
||||||
curl_low_speed_limit);
|
|
||||||
curl_easy_setopt(result, CURLOPT_LOW_SPEED_TIME,
|
|
||||||
curl_low_speed_time);
|
|
||||||
}
|
|
||||||
|
|
||||||
curl_easy_setopt(result, CURLOPT_FOLLOWLOCATION, 1);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct active_request_slot *get_active_slot(void)
|
struct active_request_slot *get_active_slot(void)
|
||||||
{
|
{
|
||||||
struct active_request_slot *slot = active_queue_head;
|
struct active_request_slot *slot = active_queue_head;
|
||||||
|
Loading…
Reference in New Issue
Block a user