aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tool_cb_hdr.c5
-rw-r--r--src/tool_operate.c7
2 files changed, 5 insertions, 7 deletions
diff --git a/src/tool_cb_hdr.c b/src/tool_cb_hdr.c
index 5be02aad2..f7d835562 100644
--- a/src/tool_cb_hdr.c
+++ b/src/tool_cb_hdr.c
@@ -48,6 +48,7 @@ size_t tool_header_cb(void *ptr, size_t size, size_t nmemb, void *userdata)
const char *str = ptr;
const size_t cb = size * nmemb;
const char *end = (char*)ptr + cb;
+ char *url = NULL;
/*
* Once that libcurl has called back tool_header_cb() the returned value
@@ -88,7 +89,9 @@ size_t tool_header_cb(void *ptr, size_t size, size_t nmemb, void *userdata)
*/
if(hdrcbdata->honor_cd_filename &&
- (cb > 20) && checkprefix("Content-disposition:", str)) {
+ (cb > 20) && checkprefix("Content-disposition:", str) &&
+ !curl_easy_getinfo(outs->config->easy, CURLINFO_EFFECTIVE_URL, &url) &&
+ url && (checkprefix("http://", url) || checkprefix("https://", url))) {
const char *p = str + 20;
/* look for the 'filename=' parameter
diff --git a/src/tool_operate.c b/src/tool_operate.c
index ab29c00b3..5f49efb71 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -1295,12 +1295,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
my_setopt_flags(curl, CURLOPT_REDIR_PROTOCOLS, config->proto_redir);
if(config->content_disposition
- && (urlnode->flags & GETOUT_USEREMOTE)
- && (checkprefix("http://", this_url) ||
- checkprefix("https://", this_url) ||
- (!strstr(this_url, "://") &&
- (!config->proto_default ||
- checkprefix("http", config->proto_default)))))
+ && (urlnode->flags & GETOUT_USEREMOTE))
hdrcbdata.honor_cd_filename = TRUE;
else
hdrcbdata.honor_cd_filename = FALSE;