All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Hengeveld <nickh@reactrix.com>
To: git@vger.kernel.org
Subject: [PATCH 3/3] Return CURL error message when object transfer fails
Date: Mon, 26 Sep 2005 10:52:11 -0700	[thread overview]
Message-ID: <20050926175211.GD9410@reactrix.com> (raw)


Return CURL error message when object transfer fails

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


---

It might be better to extend this to all places that curl_easy_perform
is called, rather than just in fetch_object.

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

330da7634e6a707779dcc8648841f501d2a47568
diff --git a/http-fetch.c b/http-fetch.c
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -19,6 +19,7 @@
 static CURL *curl;
 static struct curl_slist *no_pragma_header;
 static struct curl_slist *no_range_header;
+static char curl_errorstr[CURL_ERROR_SIZE];
 
 static char *initial_base;
 
@@ -389,6 +390,7 @@ int fetch_object(struct alt_base *repo, 
 	curl_easy_setopt(curl, CURLOPT_FILE, NULL);
 	curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite_sha1_file);
 	curl_easy_setopt(curl, CURLOPT_HTTPHEADER, no_pragma_header);
+	curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_errorstr);
 
 	url = xmalloc(strlen(repo->base) + 50);
 	strcpy(url, repo->base);
@@ -448,7 +450,7 @@ int fetch_object(struct alt_base *repo, 
 	curl_result = curl_easy_perform(curl);
 	curl_easy_setopt(curl, CURLOPT_HTTPHEADER, no_range_header);
 	if (curl_result != 0) {
-		return -1;
+		return error(curl_errorstr);
 	}
 
 	fchmod(local, 0444);

             reply	other threads:[~2005-09-26 17:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-26 17:52 Nick Hengeveld [this message]
2005-09-26 21:22 ` [PATCH 3/3] Return CURL error message when object transfer fails Junio C Hamano
2005-09-27  0:12   ` Nick Hengeveld
2005-09-27  5:51     ` Junio C Hamano
2005-09-27  6:13       ` Junio C Hamano
2005-09-27 16:07         ` Nick Hengeveld

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=20050926175211.GD9410@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.