summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 820eca6)
raw | patch | inline | side by side (parent: 820eca6)
author | Nick Hengeveld <nickh@reactrix.com> | |
Mon, 26 Sep 2005 17:52:11 +0000 (10:52 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 27 Sep 2005 07:19:18 +0000 (00:19 -0700) |
Return CURL error message when object transfer fails
[jc: added similar curl_errorstr errors to places where we
use curl_easy_perform() to run fetch that _must_ succeed.]
Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
[jc: added similar curl_errorstr errors to places where we
use curl_easy_perform() to run fetch that _must_ succeed.]
Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
http-fetch.c | patch | blob | history |
diff --git a/http-fetch.c b/http-fetch.c
index e6181b0ee603a3b9601a0ffebcfa0bd95632ef9f..0caec10468a1a2525713fbb90d9e212da5034def 100644 (file)
--- a/http-fetch.c
+++ b/http-fetch.c
static CURL *curl;
static struct curl_slist *no_pragma_header;
+static char curl_errorstr[CURL_ERROR_SIZE];
static char *initial_base;
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite);
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, no_pragma_header);
+ curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_errorstr);
if (curl_easy_perform(curl)) {
fclose(indexfile);
- return error("Unable to get pack index %s", url);
+ return error("Unable to get pack index %s\n%s", url,
+ curl_errorstr);
}
fclose(indexfile);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite_buffer);
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, NULL);
+ curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_errorstr);
- if (curl_easy_perform(curl)) {
- return -1;
- }
+ if (curl_easy_perform(curl))
+ return error("%s", curl_errorstr);
while (i < buffer.posn) {
switch (data[i]) {
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite);
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, no_pragma_header);
-
+ curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_errorstr);
+
if (curl_easy_perform(curl)) {
fclose(packfile);
- return error("Unable to get pack file %s", url);
+ return error("Unable to get pack file %s\n%s", url,
+ curl_errorstr);
}
fclose(packfile);
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);
if (curl_easy_perform(curl)) {
unlink(filename);
- return -1;
+ return error("%s", curl_errorstr);
}
fchmod(local, 0444);
curl_easy_setopt(curl, CURLOPT_FILE, &buffer);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite_buffer);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, NULL);
+ curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_errorstr);
url = xmalloc(strlen(base) + 6 + strlen(ref));
strcpy(url, base);
curl_easy_setopt(curl, CURLOPT_URL, url);
if (curl_easy_perform(curl))
- return error("Couldn't get %s for %s\n", url, ref);
+ return error("Couldn't get %s for %s\n%s",
+ url, ref, curl_errorstr);
hex[40] = '\0';
get_sha1_hex(hex, sha1);