Commits

Nick Hengeveld  committed a14c225

Fix for http-fetch from file:// URLs

Recognize missing files when using http-fetch with file:// URLs

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>

  • Participants
  • Parent commits e99fcf9

Comments (0)

Files changed (1)

File http-fetch.c

 	obj_req->state = COMPLETE;
 
 	/* Use alternates if necessary */
-	if (obj_req->http_code == 404) {
+	if (obj_req->http_code == 404 ||
+	    obj_req->curl_result == CURLE_FILE_COULDNT_READ_FILE) {
 		fetch_alternates(alt->base);
 		if (obj_req->repo->next != NULL) {
 			obj_req->repo =
 			}
 		}
 	} else if (slot->curl_result != CURLE_OK) {
-		if (slot->http_code != 404) {
+		if (slot->http_code != 404 &&
+		    slot->curl_result != CURLE_FILE_COULDNT_READ_FILE) {
 			got_alternates = -1;
 			return;
 		}
 	if (start_active_slot(slot)) {
 		run_active_slot(slot);
 		if (slot->curl_result != CURLE_OK) {
-			if (slot->http_code == 404) {
+			if (slot->http_code == 404 ||
+			    slot->curl_result == CURLE_FILE_COULDNT_READ_FILE) {
 				repo->got_indices = 1;
 				free(buffer.buffer);
 				return 0;
 		ret = error("Request for %s aborted", hex);
 	} else if (obj_req->curl_result != CURLE_OK &&
 		   obj_req->http_code != 416) {
-		if (obj_req->http_code == 404)
+		if (obj_req->http_code == 404 ||
+		    obj_req->curl_result == CURLE_FILE_COULDNT_READ_FILE)
 			ret = -1; /* Be silent, it is probably in a pack. */
 		else
 			ret = error("%s (curl_result = %d, http_code = %ld, sha1 = %s)",