summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tool_metalink.c29
-rw-r--r--src/tool_metalink.h3
-rw-r--r--src/tool_operate.c30
3 files changed, 41 insertions, 21 deletions
diff --git a/src/tool_metalink.c b/src/tool_metalink.c
index 89a99d3ec..806574133 100644
--- a/src/tool_metalink.c
+++ b/src/tool_metalink.c
@@ -330,12 +330,10 @@ static int check_hash(const char *filename,
digest_context *dctx;
int check_ok;
int fd;
- fprintf(error,
- "Metalink: Validating %s checksum (This may take some time)...\n",
- digest_def->hash_name);
+ fprintf(error, "Metalink: validating (%s)...\n", filename);
fd = open(filename, O_RDONLY);
if(fd == -1) {
- fprintf(error, "Metalink: Could not open file %s: %s\n", filename,
+ fprintf(error, "Metalink: validating (%s) FAILED (%s)\n", filename,
strerror(errno));
return -1;
}
@@ -348,7 +346,7 @@ static int check_hash(const char *filename,
break;
}
else if(len == -1) {
- fprintf(error, "Metalink: Could not read file %s: %s\n", filename,
+ fprintf(error, "Metalink: validating (%s) FAILED (%s)\n", filename,
strerror(errno));
Curl_digest_final(dctx, result);
close(fd);
@@ -361,9 +359,10 @@ static int check_hash(const char *filename,
digest_def->dparams->digest_resultlen) == 0;
/* sha*sum style verdict output */
if(check_ok)
- fprintf(error, "Metalink: %s: OK\n", filename);
+ fprintf(error, "Metalink: validating (%s) OK\n", filename);
else
- fprintf(error, "Metalink: %s: FAILED\n", filename);
+ fprintf(error, "Metalink: validating (%s) FAILED (digest mismatch)\n",
+ filename);
free(result);
close(fd);
@@ -469,7 +468,8 @@ static metalinkfile *new_metalinkfile(metalink_file_t *fileinfo)
return f;
}
-int parse_metalink(struct Configurable *config, struct OutStruct *outs)
+int parse_metalink(struct Configurable *config, struct OutStruct *outs,
+ const char *metalink_url)
{
metalink_error_t r;
metalink_t* metalink;
@@ -482,8 +482,9 @@ int parse_metalink(struct Configurable *config, struct OutStruct *outs)
return -1;
}
if(metalink->files == NULL) {
- fprintf(config->errors,
- "\nMetalink: Metalink XML file does not contain any file.\n");
+ fprintf(config->errors, "\nMetalink: parsing (%s) WARNING "
+ "(missing or invalid file name)\n",
+ metalink_url);
metalink_delete(metalink);
return 0;
}
@@ -491,9 +492,9 @@ int parse_metalink(struct Configurable *config, struct OutStruct *outs)
struct getout *url;
/* Skip an entry which has no resource. */
if(!(*files)->resources) {
- fprintf(config->errors,
- "\nMetalink: File %s does not have any resource.\n",
- (*files)->name);
+ fprintf(config->errors, "\nMetalink: parsing (%s) WARNING "
+ "(missing or invalid resource)\n",
+ metalink_url, (*files)->name);
continue;
}
if(config->url_get ||
@@ -558,7 +559,7 @@ size_t metalink_write_cb(void *buffer, size_t sz, size_t nmemb,
if(rv == 0)
return sz * nmemb;
else {
- warnf(config, "Metalink: Failed to parse Metalink XML file\n");
+ fprintf(config->errors, "Metalink: parsing FAILED\n");
return failure;
}
}
diff --git a/src/tool_metalink.h b/src/tool_metalink.h
index c2568a31e..a3d10a22c 100644
--- a/src/tool_metalink.h
+++ b/src/tool_metalink.h
@@ -90,7 +90,8 @@ extern const digest_params SHA256_DIGEST_PARAMS[1];
int count_next_metalink_resource(metalinkfile *mlfile);
void clean_metalink(struct Configurable *config);
-int parse_metalink(struct Configurable *config, struct OutStruct *outs);
+int parse_metalink(struct Configurable *config, struct OutStruct *outs,
+ const char *metalink_url);
/*
* Callback function for CURLOPT_WRITEFUNCTION
diff --git a/src/tool_operate.c b/src/tool_operate.c
index d944a0093..0b828de4b 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -1346,7 +1346,12 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
res = CURLE_OUT_OF_MEMORY;
goto show_error;
}
+ fprintf(config->errors, "Metalink: parsing (%s) metalink/XML...\n",
+ this_url);
}
+ else if(metalink)
+ fprintf(config->errors, "Metalink: fetching (%s) from (%s)...\n",
+ mlfile->filename, this_url);
#endif /* USE_METALINK */
res = curl_easy_perform(curl);
@@ -1486,12 +1491,25 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response);
if(response != 200 && response != 206) {
metalink_next_res = 1;
+ fprintf(config->errors,
+ "Metalink: fetching (%s) from (%s) FAILED "
+ "(HTTP status code %d)\n",
+ mlfile->filename, this_url, response);
}
}
}
- else
+ else {
metalink_next_res = 1;
+ fprintf(config->errors,
+ "Metalink: fetching (%s) from (%s) FAILED (%s)\n",
+ mlfile->filename, this_url,
+ (errorbuffer[0]) ?
+ errorbuffer : curl_easy_strerror((CURLcode)res));
+ }
}
+ if(metalink && !metalink_next_res)
+ fprintf(config->errors, "Metalink: fetching (%s) from (%s) OK\n",
+ mlfile->filename, this_url);
/* In all ordinary cases, just break out of loop here */
break; /* curl_easy_perform loop */
@@ -1603,12 +1621,12 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
#ifdef USE_METALINK
if(!metalink && config->use_metalink && res == CURLE_OK) {
- if(parse_metalink(config, &outs) == 0)
- fprintf(config->errors,
- "Metalink: Metalink XML file was parsed successfully\n");
+ if(parse_metalink(config, &outs, this_url) == 0)
+ fprintf(config->errors, "Metalink: parsing (%s) OK\n",
+ this_url);
else
- fprintf(config->errors,
- "Metalink: Could not parse Metalink XML file\n");
+ fprintf(config->errors, "Metalink: parsing (%s) FAILED\n",
+ this_url);
}
else if(metalink && res == CURLE_OK && !metalink_next_res) {
int rv = metalink_check_hash(config, mlfile, outs.filename);