summaryrefslogtreecommitdiff
path: root/src/tool_operate.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tool_operate.c')
-rw-r--r--src/tool_operate.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/src/tool_operate.c b/src/tool_operate.c
index 66ab0fab..272ebd4f 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -543,26 +543,37 @@ static CURLcode operate_do(struct GlobalConfig *global,
result = get_url_file_name(&outfile, this_url);
if(result)
goto show_error;
+
+#if defined(MSDOS) || defined(WIN32)
+ result = sanitize_file_name(&outfile);
+ if(result) {
+ Curl_safefree(outfile);
+ goto show_error;
+ }
+#endif /* MSDOS || WIN32 */
+
if(!*outfile && !config->content_disposition) {
helpf(global->errors, "Remote file name has no length!\n");
result = CURLE_WRITE_ERROR;
goto quit_urls;
}
-#if defined(MSDOS) || defined(WIN32)
- /* For DOS and WIN32, we do some major replacing of
- bad characters in the file name before using it */
- outfile = sanitize_dos_name(outfile);
- if(!outfile) {
- result = CURLE_OUT_OF_MEMORY;
- goto show_error;
- }
-#endif /* MSDOS || WIN32 */
}
else if(urls) {
/* fill '#1' ... '#9' terms from URL pattern */
char *storefile = outfile;
result = glob_match_url(&outfile, storefile, urls);
Curl_safefree(storefile);
+
+#if defined(MSDOS) || defined(WIN32)
+ if(!result) {
+ result = sanitize_file_name(&outfile);
+ if(result) {
+ Curl_safefree(outfile);
+ goto show_error;
+ }
+ }
+#endif /* MSDOS || WIN32 */
+
if(result) {
/* bad globbing */
warnf(config->global, "bad output glob!\n");
@@ -956,9 +967,11 @@ static CURLcode operate_do(struct GlobalConfig *global,
/* new in libcurl 7.5 */
my_setopt(curl, CURLOPT_MAXREDIRS, config->maxredirs);
- /* new in libcurl 7.9.1 */
if(config->httpversion)
my_setopt_enum(curl, CURLOPT_HTTP_VERSION, config->httpversion);
+ else if(curlinfo->features & CURL_VERSION_HTTP2) {
+ my_setopt_enum(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2TLS);
+ }
/* new in libcurl 7.10.6 (default is Basic) */
if(config->authtype)
@@ -1262,10 +1275,6 @@ static CURLcode operate_do(struct GlobalConfig *global,
if(!config->nokeepalive) {
my_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
if(config->alivetime != 0) {
-#if !defined(TCP_KEEPIDLE) || !defined(TCP_KEEPINTVL)
- warnf(config->global, "Keep-alive functionality somewhat crippled "
- "due to missing support in your operating system!\n");
-#endif
my_setopt(curl, CURLOPT_TCP_KEEPIDLE, config->alivetime);
my_setopt(curl, CURLOPT_TCP_KEEPINTVL, config->alivetime);
}
@@ -1360,6 +1369,11 @@ static CURLcode operate_do(struct GlobalConfig *global,
if(config->proto_default)
my_setopt_str(curl, CURLOPT_DEFAULT_PROTOCOL, config->proto_default);
+ /* new in 7.47.0 */
+ if(config->expect100timeout > 0)
+ my_setopt_str(curl, CURLOPT_EXPECT_100_TIMEOUT_MS,
+ (long)(config->expect100timeout*1000));
+
/* initialize retry vars for loop below */
retry_sleep_default = (config->retry_delay) ?
config->retry_delay*1000L : RETRY_SLEEP_DEFAULT; /* ms */