diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-12-19 14:45:32 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-12-19 14:45:32 -0800 |
commit | da72ee87fb5f27f44b1b48a18765ab1c6280f070 (patch) | |
tree | f9af3a68640a73ca1102e43ef64b3cd98f2e8ce7 /http-walker.c | |
parent | 8a2882f23ecce3a8742743555a408e508d4db806 (diff) | |
parent | 3680f16f9d6832dc78c6b80f1e8a546385d946f9 (diff) | |
download | git-da72ee87fb5f27f44b1b48a18765ab1c6280f070.tar.gz |
Merge branch 'jk/http-walker-limit-redirect'
Update the error messages from the dumb-http client when it fails
to obtain loose objects; we used to give sensible error message
only upon 404 but we now forbid unexpected redirects that needs to
be reported with something sensible.
* jk/http-walker-limit-redirect:
http-walker: complain about non-404 loose object errors
Diffstat (limited to 'http-walker.c')
-rw-r--r-- | http-walker.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/http-walker.c b/http-walker.c index 25a8b1ad4b..c2f81cd6af 100644 --- a/http-walker.c +++ b/http-walker.c @@ -482,10 +482,13 @@ static int fetch_object(struct walker *walker, unsigned char *sha1) * we turned off CURLOPT_FAILONERROR to avoid losing a * persistent connection and got CURLE_OK. */ - if (req->http_code == 404 && req->curl_result == CURLE_OK && + if (req->http_code >= 300 && req->curl_result == CURLE_OK && (starts_with(req->url, "http://") || - starts_with(req->url, "https://"))) + starts_with(req->url, "https://"))) { req->curl_result = CURLE_HTTP_RETURNED_ERROR; + xsnprintf(req->errorstr, sizeof(req->errorstr), + "HTTP request failed"); + } if (obj_req->state == ABORTED) { ret = error("Request for %s aborted", hex); |