diff options
Diffstat (limited to 'http.c')
-rw-r--r-- | http.c | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -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; @@ -60,7 +61,7 @@ static struct curl_slist *no_pragma_header; static struct active_request_slot *active_queue_head; -size_t fread_buffer(void *ptr, size_t eltsize, size_t nmemb, void *buffer_) +size_t fread_buffer(char *ptr, size_t eltsize, size_t nmemb, void *buffer_) { size_t size = eltsize * nmemb; struct buffer *buffer = buffer_; @@ -92,7 +93,7 @@ curlioerr ioctl_buffer(CURL *handle, int cmd, void *clientp) } #endif -size_t fwrite_buffer(const void *ptr, size_t eltsize, size_t nmemb, void *buffer_) +size_t fwrite_buffer(char *ptr, size_t eltsize, size_t nmemb, void *buffer_) { size_t size = eltsize * nmemb; struct strbuf *buffer = buffer_; @@ -102,7 +103,7 @@ size_t fwrite_buffer(const void *ptr, size_t eltsize, size_t nmemb, void *buffer return size; } -size_t fwrite_null(const void *ptr, size_t eltsize, size_t nmemb, void *strbuf) +size_t fwrite_null(char *ptr, size_t eltsize, size_t nmemb, void *strbuf) { data_received++; return eltsize * nmemb; @@ -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) @@ -531,11 +535,13 @@ 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); curl_easy_setopt(slot->curl, CURLOPT_READFUNCTION, NULL); curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, NULL); + curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDS, NULL); curl_easy_setopt(slot->curl, CURLOPT_UPLOAD, 0); curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1); @@ -1166,7 +1172,7 @@ abort: } /* Helpers for fetching objects (loose) */ -static size_t fwrite_sha1_file(void *ptr, size_t eltsize, size_t nmemb, +static size_t fwrite_sha1_file(char *ptr, size_t eltsize, size_t nmemb, void *data) { unsigned char expn[4096]; @@ -1183,7 +1189,7 @@ static size_t fwrite_sha1_file(void *ptr, size_t eltsize, size_t nmemb, } while (posn < size); freq->stream.avail_in = size; - freq->stream.next_in = ptr; + freq->stream.next_in = (void *)ptr; do { freq->stream.next_out = expn; freq->stream.avail_out = sizeof(expn); @@ -1202,7 +1208,7 @@ struct http_object_request *new_http_object_request(const char *base_url, char *filename; char prevfile[PATH_MAX]; int prevlocal; - unsigned char prev_buf[PREV_BUF_SIZE]; + char prev_buf[PREV_BUF_SIZE]; ssize_t prev_read = 0; long prev_posn = 0; char range[RANGE_HEADER_SIZE]; |