Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
curl: warn loudly when not able to provide remote Last modification time
Baptiste Daroussin committed 2 years ago
commit 942b46c2aad7e24fb68baeb8b140bac6229e1302
parent 0ec04db
1 file changed +10 -3
modified libpkg/fetch_libcurl.c
@@ -351,6 +351,7 @@ curl_fetch(struct pkg_repo *repo, int dest, struct fetch_item *fi)
{
	CURL *cl;
	CURLU *hu = NULL;
+
	CURLcode res;
	struct curl_userdata data = { 0 };
	int64_t retry;
	int retcode = EPKG_OK;
@@ -474,8 +475,8 @@ retry:
	}

	long rc = curl_do_fetch(&data, cl, cr);
-
	time_t t;
-
	curl_easy_getinfo(cl, CURLINFO_FILETIME_T, &t);
+
	curl_off_t t;
+
	res = curl_easy_getinfo(cl, CURLINFO_FILETIME_T, &t);
	curl_multi_remove_handle(cr->cm, cl);
	curl_easy_cleanup(cl);
	if (rc == 304) {
@@ -491,7 +492,13 @@ retry:
			goto retry;
	}

-
	fi->mtime = t;
+
	if (res == CURLE_OK && t >= 0) {
+
		fi->mtime = t;
+
	} else {
+
		pkg_emit_error("Impossible to get the value from Last-Modified"
+
		    " HTTP header");
+
		fi->mtime = 0;
+
	}
	fclose(data.fh);
	free(urlpath);
	curl_url_cleanup(hu);