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
This commit is contained in:
commit
da72ee87fb
@ -482,10 +482,13 @@ static int fetch_object(struct walker *walker, unsigned char *sha1)
|
|||||||
* we turned off CURLOPT_FAILONERROR to avoid losing a
|
* we turned off CURLOPT_FAILONERROR to avoid losing a
|
||||||
* persistent connection and got CURLE_OK.
|
* 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, "http://") ||
|
||||||
starts_with(req->url, "https://")))
|
starts_with(req->url, "https://"))) {
|
||||||
req->curl_result = CURLE_HTTP_RETURNED_ERROR;
|
req->curl_result = CURLE_HTTP_RETURNED_ERROR;
|
||||||
|
xsnprintf(req->errorstr, sizeof(req->errorstr),
|
||||||
|
"HTTP request failed");
|
||||||
|
}
|
||||||
|
|
||||||
if (obj_req->state == ABORTED) {
|
if (obj_req->state == ABORTED) {
|
||||||
ret = error("Request for %s aborted", hex);
|
ret = error("Request for %s aborted", hex);
|
||||||
|
2
http.c
2
http.c
@ -2058,7 +2058,7 @@ static size_t fwrite_sha1_file(char *ptr, size_t eltsize, size_t nmemb,
|
|||||||
if (c != CURLE_OK)
|
if (c != CURLE_OK)
|
||||||
die("BUG: curl_easy_getinfo for HTTP code failed: %s",
|
die("BUG: curl_easy_getinfo for HTTP code failed: %s",
|
||||||
curl_easy_strerror(c));
|
curl_easy_strerror(c));
|
||||||
if (slot->http_code >= 400)
|
if (slot->http_code >= 300)
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user