aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 276718b54..56cd133d3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -5415,8 +5415,6 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
my_setopt(curl, CURLOPT_QUOTE, config->quote);
my_setopt(curl, CURLOPT_POSTQUOTE, config->postquote);
my_setopt(curl, CURLOPT_PREQUOTE, config->prequote);
- my_setopt(curl, CURLOPT_HEADERDATA,
- config->headerfile?&heads:NULL);
my_setopt_str(curl, CURLOPT_COOKIEFILE, config->cookiefile);
/* cookie jar was added in 7.9 */
if(config->cookiejar)
@@ -5621,6 +5619,12 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
my_setopt(curl, CURLOPT_HEADERFUNCTION, header_callback);
my_setopt(curl, CURLOPT_HEADERDATA, &outs);
}
+ else {
+ /* if HEADERFUNCTION was set to something in the previous loop, it
+ is important that we set it (back) to NULL now */
+ my_setopt(curl, CURLOPT_HEADERFUNCTION, NULL);
+ my_setopt(curl, CURLOPT_HEADERDATA, config->headerfile?&heads:NULL);
+ }
if(config->resolve)
/* new in 7.21.3 */