mirror of
https://github.com/curl/curl.git
synced 2026-05-16 18:26:25 +03:00
transfer: make Expect: 100-continue timeout configurable.
Replaced the #define CURL_TIMEOUT_EXPECT_100 in transfer.c with the CURLOPT_EXPECT_100_TIMEOUT_MS option to make the timeout configurable.
This commit is contained in:
parent
bcb32e915e
commit
c021a60bcc
6 changed files with 26 additions and 5 deletions
|
|
@ -87,8 +87,6 @@
|
|||
/* The last #include file should be: */
|
||||
#include "memdebug.h"
|
||||
|
||||
#define CURL_TIMEOUT_EXPECT_100 1000 /* counting ms here */
|
||||
|
||||
/*
|
||||
* This function will call the read callback to fill our buffer with data
|
||||
* to upload.
|
||||
|
|
@ -839,7 +837,7 @@ static CURLcode readwrite_upload(struct SessionHandle *data,
|
|||
*didwhat &= ~KEEP_SEND; /* we didn't write anything actually */
|
||||
|
||||
/* set a timeout for the multi interface */
|
||||
Curl_expire(data, CURL_TIMEOUT_EXPECT_100);
|
||||
Curl_expire(data, data->set.expect_100_timeout);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1075,7 +1073,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
|
|||
*/
|
||||
|
||||
long ms = Curl_tvdiff(k->now, k->start100);
|
||||
if(ms >= CURL_TIMEOUT_EXPECT_100) {
|
||||
if(ms >= data->set.expect_100_timeout) {
|
||||
/* we've waited long enough, continue anyway */
|
||||
k->exp100 = EXP100_SEND_DATA;
|
||||
k->keepon |= KEEP_SEND;
|
||||
|
|
@ -1969,7 +1967,7 @@ Curl_setup_transfer(
|
|||
|
||||
/* Set a timeout for the multi interface. Add the inaccuracy margin so
|
||||
that we don't fire slightly too early and get denied to run. */
|
||||
Curl_expire(data, CURL_TIMEOUT_EXPECT_100);
|
||||
Curl_expire(data, data->set.expect_100_timeout);
|
||||
}
|
||||
else {
|
||||
if(data->state.expect100header)
|
||||
|
|
|
|||
10
lib/url.c
10
lib/url.c
|
|
@ -565,6 +565,8 @@ CURLcode Curl_init_userdefined(struct UserDefined *set)
|
|||
|
||||
set->ssl_enable_npn = TRUE;
|
||||
set->ssl_enable_alpn = TRUE;
|
||||
|
||||
set->expect_100_timeout = 1000L; /* Wait for a second by default. */
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -1256,6 +1258,14 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
|||
}
|
||||
break;
|
||||
|
||||
case CURLOPT_EXPECT_100_TIMEOUT_MS:
|
||||
/*
|
||||
* Time to wait for a response to a HTTP request containing an
|
||||
* Expect: 100-continue header before sending the data anyway.
|
||||
*/
|
||||
data->set.expect_100_timeout = va_arg(param, long);
|
||||
break;
|
||||
|
||||
#endif /* CURL_DISABLE_HTTP */
|
||||
|
||||
case CURLOPT_CUSTOMREQUEST:
|
||||
|
|
|
|||
|
|
@ -1596,6 +1596,8 @@ struct UserDefined {
|
|||
|
||||
bool ssl_enable_npn; /* TLS NPN extension? */
|
||||
bool ssl_enable_alpn; /* TLS ALPN extension? */
|
||||
|
||||
long expect_100_timeout; /* in milliseconds */
|
||||
};
|
||||
|
||||
struct Names {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue