summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2020-01-22 21:01:41 -0500
committerJason Woodward2020-01-22 21:01:41 -0500
commit4c51ce804cdf0afcbbce62885de9d922929db2ba (patch)
tree1e061383581f94d3273a5dbe20bf8c334a0abe65
parent00e10109878da7bb99a7dcdf34981af4ec9fefac (diff)
downloadslapt-get-master.tar.gz
add SLAPT_CURL_DEBUG env for dumping libcurl informationHEADmaster
-rw-r--r--src/slaptcurl.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/slaptcurl.c b/src/slaptcurl.c
index 7e444d8..dcbe7db 100644
--- a/src/slaptcurl.c
+++ b/src/slaptcurl.c
@@ -56,6 +56,8 @@ int slapt_download_data(FILE *fh, const char *url, size_t bytes, long *filetime,
/* ugh, if someone wants to do this */
if (getenv(SLAPT_NO_SSL_VERIFYPEER))
curl_easy_setopt(ch, CURLOPT_SSL_VERIFYPEER, 0);
+ if (getenv("SLAPT_CURL_DEBUG"))
+ curl_easy_setopt(ch, CURLOPT_VERBOSE, 1);
headers = curl_slist_append(headers, "Pragma: "); /* override no-cache */
@@ -117,6 +119,7 @@ char *slapt_head_request(const char *url)
struct curl_slist *headers = NULL;
head_t.data = slapt_malloc(sizeof *head_t.data);
+ head_t.data = '\0';
head_t.size = 0;
ch = curl_easy_init();
@@ -142,9 +145,12 @@ char *slapt_head_request(const char *url)
curl_easy_setopt(ch, CURLOPT_FILETIME, 1);
curl_easy_setopt(ch, CURLOPT_FOLLOWLOCATION, 1);
+ if (getenv("SLAPT_CURL_DEBUG"))
+ curl_easy_setopt(ch, CURLOPT_VERBOSE, 1);
+
headers = curl_slist_append(headers, "Pragma: "); /* override no-cache */
- if ((response = curl_easy_perform(ch)) != 0) {
+ if ((response = curl_easy_perform(ch)) != CURLE_OK) {
free(head_t.data);
curl_easy_cleanup(ch);
curl_slist_free_all(headers);