]> granicus.if.org Git - curl/commitdiff
curl --expect100-timeout: added
authorDaniel Stenberg <daniel@haxx.se>
Mon, 14 Dec 2015 12:29:13 +0000 (13:29 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 15 Dec 2015 12:59:56 +0000 (13:59 +0100)
This is the new command line option to set the value for the existing
libcurl option CURLOPT_EXPECT_100_TIMEOUT_MS

docs/curl.1
src/tool_cfgable.h
src/tool_getparam.c
src/tool_help.c
src/tool_operate.c

index eabcc9629f5e687769e1cd600c89cfbd44517481..5cc7c7306a64a3880f8ca674d43bcf566c0ef759 100644 (file)
@@ -523,6 +523,13 @@ after having run curl.
 (SSL) Specify the path name to the Entropy Gathering Daemon socket. The socket
 is used to seed the random engine for SSL connections. See also the
 \fI--random-file\fP option.
+.IP "--expect100-timeout <seconds>"
+(HTTP) Maximum time in seconds that you allow curl to wait for a 100-continue
+response when curl emits an Expects: 100-continue header in its request. By
+default curl will wait one second. This option accepts decimal values! When
+curl stops waiting, it will continue as if the response has been received.
+
+(Added in 7.47.0)
 .IP "--cert-type <type>"
 (SSL) Tells curl what certificate type the provided certificate is in. PEM,
 DER and ENG are recognized types.  If not specified, PEM is assumed.
index 85b8bcfee340fe91b099d1e8ed73df07822840ee..b92a273d11e4900799c8dd0e0a893ae1fd5d187f 100644 (file)
@@ -214,6 +214,7 @@ struct OperationConfig {
   char *unix_socket_path;         /* path to Unix domain socket */
   bool falsestart;
   bool path_as_is;
+  double expect100timeout;
   struct GlobalConfig *global;
   struct OperationConfig *prev;
   struct OperationConfig *next;   /* Always last in the struct */
index fd20cdc26d087bf947021adcfb46534871299c18..d123e231baf79d3b208359301fe58bb1a7f0fdfb 100644 (file)
@@ -179,6 +179,7 @@ static const struct LongShort aliases[]= {
   {"$O", "proxy-service-name",       TRUE},
   {"$P", "service-name",             TRUE},
   {"$Q", "proto-default",            TRUE},
+  {"$R", "expect100-timeout",        TRUE},
   {"0",   "http1.0",                 FALSE},
   {"01",  "http1.1",                 FALSE},
   {"02",  "http2",                   FALSE},
@@ -999,6 +1000,11 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
         if(err)
           return err;
         break;
+      case 'R': /* --expect100-timeout */
+        err = str2udouble(&config->expect100timeout, nextarg);
+        if(err)
+          return err;
+        break;
       }
       break;
     case '#': /* --progress-bar */
index 4f569cde6f2db76ca38b13ce02e095fca1998129..bbb2f66be2eb574ea66559b03058fd109008b344 100644 (file)
@@ -83,6 +83,7 @@ static const char *const helptext[] = {
 #ifdef USE_ENVIRONMENT
   "     --environment   Write results to environment variables (RISC OS)",
 #endif
+  "     --expect100-timeout SECONDS How long to wait for 100-continue (H)",
   " -f, --fail          Fail silently (no output at all) on HTTP errors (H)",
   "     --false-start   Enable TLS False Start.",
   " -F, --form CONTENT  Specify HTTP multipart POST data (H)",
index e5506c6fa99569d29b30b1c165c8aad0c54fcb20..30d60cb334a7f22d62b7aedfda1758d8c07b7e71 100644 (file)
@@ -1358,6 +1358,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 */