All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Hengeveld <nickh@reactrix.com>
To: git@vger.kernel.org
Subject: [PATCH] Fix for http-fetch from file:// URLs
Date: Thu, 22 Dec 2005 09:09:05 -0800	[thread overview]
Message-ID: <20051222170905.GB3876@reactrix.com> (raw)

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

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>


---

By way of explanation, our content distribution clients use a
self-referential file:// URL when fetching updates, and all actual
content servers are listed in http-alternates.  This removes the
dependency on a single external primary server so updates will
continue to work as long as any one server is available.

 http-fetch.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

applies-to: 3ca81810fe174dec38fa6ccec874559a39d8893f
92865a7cc1ea511f88d1ab8aa4c0faa50e05566b
diff --git a/http-fetch.c b/http-fetch.c
index 3cd6ef9..61b2188 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -267,7 +267,8 @@ static void process_object_response(void
 	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 =
@@ -475,7 +476,8 @@ static void process_alternates_response(
 			}
 		}
 	} 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;
 		}
@@ -637,7 +639,8 @@ static int fetch_indices(struct alt_base
 	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;
@@ -802,7 +805,8 @@ static int fetch_object(struct alt_base 
 		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)",
---
0.99.9.GIT

                 reply	other threads:[~2005-12-22 17:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051222170905.GB3876@reactrix.com \
    --to=nickh@reactrix.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.