diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-08-03 15:10:24 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-08-03 15:10:24 -0700 |
commit | 4067a45438282fe967779fcbc5c3513d2cbb5913 (patch) | |
tree | 9dd3719c28232c4e89aca257ba484e56992174bb /http.c | |
parent | 6395499a68d28f7211e9b4f6d9b2482c7b1681d6 (diff) | |
parent | ecba19531ac68586b4e06f6cc40e92447091bc28 (diff) | |
download | git-4067a45438282fe967779fcbc5c3513d2cbb5913.tar.gz |
Merge branch 'ew/http-walker'
Dumb http transport on the client side has been optimized.
* ew/http-walker:
list: avoid incompatibility with *BSD sys/queue.h
http-walker: reduce O(n) ops with doubly-linked list
http: avoid disconnecting on 404s for loose objects
http-walker: remove unused parameter from fetch_object
Diffstat (limited to 'http.c')
-rw-r--r-- | http.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -1975,8 +1975,19 @@ static size_t fwrite_sha1_file(char *ptr, size_t eltsize, size_t nmemb, unsigned char expn[4096]; size_t size = eltsize * nmemb; int posn = 0; - struct http_object_request *freq = - (struct http_object_request *)data; + struct http_object_request *freq = data; + struct active_request_slot *slot = freq->slot; + + if (slot) { + CURLcode c = curl_easy_getinfo(slot->curl, CURLINFO_HTTP_CODE, + &slot->http_code); + if (c != CURLE_OK) + die("BUG: curl_easy_getinfo for HTTP code failed: %s", + curl_easy_strerror(c)); + if (slot->http_code >= 400) + return size; + } + do { ssize_t retval = xwrite(freq->localfile, (char *) ptr + posn, size - posn); @@ -2097,6 +2108,7 @@ struct http_object_request *new_http_object_request(const char *base_url, freq->slot = get_active_slot(); curl_easy_setopt(freq->slot->curl, CURLOPT_FILE, freq); + curl_easy_setopt(freq->slot->curl, CURLOPT_FAILONERROR, 0); curl_easy_setopt(freq->slot->curl, CURLOPT_WRITEFUNCTION, fwrite_sha1_file); curl_easy_setopt(freq->slot->curl, CURLOPT_ERRORBUFFER, freq->errorstr); curl_easy_setopt(freq->slot->curl, CURLOPT_URL, freq->url); |