[pacman-dev] libalpm: Log URLs when retrying

Message ID 20210909084122.1020752-1-archlinux@cy.md
State New
Headers show
Series [pacman-dev] libalpm: Log URLs when retrying | expand

Commit Message

Vladimir Panteleev Sept. 9, 2021, 8:41 a.m. UTC
Allow finding which mirror was used to fetch a file.

This makes it a bit easier to debug situations in which mirrors serve
bad files with HTTP 200.

Signed-off-by: Vladimir Panteleev <archlinux@cy.md>
---
 lib/libalpm/dload.c | 3 +++
 1 file changed, 3 insertions(+)

Patch

diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index 4322318b..022bc7fd 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -427,6 +427,9 @@  static int curl_retry_next_server(CURLM *curlm, CURL *curl, struct dload_payload
 	len = strlen(server) + strlen(payload->filepath) + 2;
 	MALLOC(payload->fileurl, len, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
 	snprintf(payload->fileurl, len, "%s/%s", server, payload->filepath);
+	_alpm_log(handle, ALPM_LOG_DEBUG,
+			"%s: retrying from %s\n",
+			payload->remote_name, payload->fileurl);
 
 
 	fflush(payload->localf);