From 4f6064beff74fc1cffbabfedf8b2d110a74cc9cc Mon Sep 17 00:00:00 2001 From: Otavio Pontes Date: Tue, 12 Feb 2019 15:18:09 -0800 Subject: [PATCH] curl: Make messages consistent Replace all usages of "Curl: " to "Curl - " Signed-off-by: Otavio Pontes --- src/curl.c | 14 +++++++------- src/curl_async.c | 10 +++++----- test/functional/update/update-slow-server.bats | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/curl.c b/src/curl.c index cc5fbfc9..e23db23e 100644 --- a/src/curl.c +++ b/src/curl.c @@ -392,7 +392,7 @@ enum download_status process_curl_error_codes(int curl_ret, CURL *curl_handle) response = -1; // Force error } } - debug("Curl: process_curl_error_codes: curl_ret = %d, response = %d\n", curl_ret, response); + debug("Curl - process_curl_error_codes: curl_ret = %d, response = %d\n", curl_ret, response); /* curl command succeeded, download might've failed, let our caller handle */ switch (response) { case 206: @@ -402,17 +402,17 @@ enum download_status process_curl_error_codes(int curl_ret, CURL *curl_handle) case 0: return DOWNLOAD_STATUS_COMPLETED; case 403: - debug("Curl: Download failed - forbidden (403) - '%s'\n", url); + debug("Curl - Download failed - forbidden (403) - '%s'\n", url); return DOWNLOAD_STATUS_FORBIDDEN; case 404: - debug("Curl: Download failed - file not found (404) - '%s'\n", url); + debug("Curl - Download failed - file not found (404) - '%s'\n", url); return DOWNLOAD_STATUS_NOT_FOUND; default: error("Curl - Download failed: response (%ld) - '%s'\n", response, url); return DOWNLOAD_STATUS_ERROR; } } else { /* download failed but let our caller do it */ - debug("Curl: process_curl_error_codes - curl_ret = %d\n", curl_ret); + debug("Curl - process_curl_error_codes - curl_ret = %d\n", curl_ret); switch (curl_ret) { case CURLE_COULDNT_RESOLVE_PROXY: error("Curl - Could not resolve proxy\n"); @@ -485,7 +485,7 @@ restart_download: local.path = filename; if (resume_ok && resume_download_supported && lstat(filename, &stat) == 0) { - print("Curl: Resuming download for '%s'\n", url); + print("Curl - Resuming download for '%s'\n", url); curl_ret = curl_easy_setopt(curl, CURLOPT_RESUME_FROM_LARGE, (curl_off_t)stat.st_size); if (curl_ret != CURLE_OK) { goto exit; @@ -524,7 +524,7 @@ restart_download: goto exit; } - debug("Curl: Start sync download: %s -> %s\n", url, in_memory_file ? "" : filename); + debug("Curl - Start sync download: %s -> %s\n", url, in_memory_file ? "" : filename); curl_ret = curl_easy_perform(curl); exit: @@ -533,7 +533,7 @@ exit: } status = process_curl_error_codes(curl_ret, curl); - debug("Curl: Complete sync download: %s -> %s, status=%d\n", url, in_memory_file ? "" : filename, status); + debug("Curl - Complete sync download: %s -> %s, status=%d\n", url, in_memory_file ? "" : filename, status); if (status == DOWNLOAD_STATUS_RANGE_ERROR) { // Reset variable memset(&local, 0, sizeof(local)); diff --git a/src/curl_async.c b/src/curl_async.c index ad150d89..10074a73 100644 --- a/src/curl_async.c +++ b/src/curl_async.c @@ -170,7 +170,7 @@ static void reevaluate_number_of_parallel_downloads(struct swupd_curl_parallel_h h->max_xfer = 1; } - print("Curl: Reducing number of parallel downloads to %ld\n", h->max_xfer); + print("Curl - Reducing number of parallel downloads to %ld\n", h->max_xfer); } void *swupd_curl_parallel_download_start(size_t max_xfer) @@ -254,7 +254,7 @@ static int perform_curl_io_and_complete(struct swupd_curl_parallel_handle *h, in * completing the download encounters further problems. */ curl_ret = swupd_download_file_close(msg->data.result, &file->file); file->status = process_curl_error_codes(curl_ret, handle); - debug("Curl: Complete ASYNC download: %s -> %s, status=%d\n", file->url, file->file.path, file->status); + debug("Curl - Complete ASYNC download: %s -> %s, status=%d\n", file->url, file->file.path, file->status); if (file->status == DOWNLOAD_STATUS_COMPLETED) { /* Wrap the success callback and schedule execution * Results from the callback will be stored in multi_curl_file's cb_retval @@ -416,7 +416,7 @@ static int process_download(struct swupd_curl_parallel_handle *h, struct multi_c file->curl = curl; if (file->retries > 0 && !h->resume_failed && lstat(file->file.path, &stat) == 0) { - print("Curl: Resuming download for '%s'\n", file->url); + print("Curl - Resuming download for '%s'\n", file->url); curl_ret = curl_easy_setopt(curl, CURLOPT_RESUME_FROM_LARGE, (curl_off_t)stat.st_size); if (curl_ret != CURLE_OK) { goto out_bad; @@ -444,7 +444,7 @@ static int process_download(struct swupd_curl_parallel_handle *h, struct multi_c goto out_bad; } - debug("Curl: Start ASYNC download: %s -> %s\n", file->url, file->file.path); + debug("Curl - Start ASYNC download: %s -> %s\n", file->url, file->file.path); curlm_ret = curl_multi_add_handle(h->mcurl, curl); if (curlm_ret != CURLM_OK) { goto out_bad; @@ -550,7 +550,7 @@ int swupd_curl_parallel_download_end(void *handle, int *num_downloads) // Retry was probably scheduled because of network problems, so // reevaluate the number of parallel downloads reevaluate_number_of_parallel_downloads(h, file->retries); - print("Curl: Starting download retry #%d for %s\n", file->retries, file->url); + print("Curl - Starting download retry #%d for %s\n", file->retries, file->url); process_download(h, file); retry = true; continue; diff --git a/test/functional/update/update-slow-server.bats b/test/functional/update/update-slow-server.bats index b77a4785..56822621 100755 --- a/test/functional/update/update-slow-server.bats +++ b/test/functional/update/update-slow-server.bats @@ -41,10 +41,10 @@ test_teardown() { Preparing to update from 10 to 100 Downloading packs... Error: Curl - File incompletely downloaded - '.*/100/pack-test-bundle-from-10.tar' - Curl: Starting download retry #1 for .*/100/pack-test-bundle-from-10.tar - Curl: Resuming download for '.*/100/pack-test-bundle-from-10.tar' + Curl - Starting download retry #1 for .*/100/pack-test-bundle-from-10.tar + Curl - Resuming download for '.*/100/pack-test-bundle-from-10.tar' Error: Curl - Range command not supported by server, download resume disabled - '.*/100/pack-test-bundle-from-10.tar' - Curl: Starting download retry #2 for .*/100/pack-test-bundle-from-10.tar + Curl - Starting download retry #2 for .*/100/pack-test-bundle-from-10.tar Extracting test-bundle pack for version 100 Statistics for going from version 10 to version 100: changed bundles : 1