mirror of
https://github.com/curl/curl.git
synced 2025-04-12 16:20:35 +08:00
urldata: change 4 timeouts to unsigned int from long
They're not used for that long times anyway, 32 bit milliseconds is long enough. Closes #9101
This commit is contained in:
parent
fe14ff6150
commit
3622bf4e79
32
lib/setopt.c
32
lib/setopt.c
@ -236,9 +236,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
||||
char *argptr;
|
||||
CURLcode result = CURLE_OK;
|
||||
long arg;
|
||||
#ifdef ENABLE_IPV6
|
||||
unsigned long uarg;
|
||||
#endif
|
||||
curl_off_t bigsize;
|
||||
|
||||
switch(option) {
|
||||
@ -396,7 +394,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
||||
*/
|
||||
arg = va_arg(param, long);
|
||||
if((arg >= 0) && (arg <= (INT_MAX/1000)))
|
||||
data->set.server_response_timeout = arg * 1000;
|
||||
data->set.server_response_timeout = (unsigned int)arg * 1000;
|
||||
else
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
break;
|
||||
@ -1448,16 +1446,16 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
||||
*/
|
||||
arg = va_arg(param, long);
|
||||
if((arg >= 0) && (arg <= (INT_MAX/1000)))
|
||||
data->set.timeout = arg * 1000;
|
||||
data->set.timeout = (unsigned int)arg * 1000;
|
||||
else
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
break;
|
||||
|
||||
case CURLOPT_TIMEOUT_MS:
|
||||
arg = va_arg(param, long);
|
||||
if(arg < 0)
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
data->set.timeout = arg;
|
||||
uarg = va_arg(param, unsigned long);
|
||||
if(uarg >= UINT_MAX)
|
||||
uarg = UINT_MAX;
|
||||
data->set.timeout = (unsigned int)uarg;
|
||||
break;
|
||||
|
||||
case CURLOPT_CONNECTTIMEOUT:
|
||||
@ -1466,16 +1464,16 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
||||
*/
|
||||
arg = va_arg(param, long);
|
||||
if((arg >= 0) && (arg <= (INT_MAX/1000)))
|
||||
data->set.connecttimeout = arg * 1000;
|
||||
data->set.connecttimeout = (unsigned int)arg * 1000;
|
||||
else
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
break;
|
||||
|
||||
case CURLOPT_CONNECTTIMEOUT_MS:
|
||||
arg = va_arg(param, long);
|
||||
if(arg < 0)
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
data->set.connecttimeout = arg;
|
||||
uarg = va_arg(param, unsigned long);
|
||||
if(uarg >= UINT_MAX)
|
||||
uarg = UINT_MAX;
|
||||
data->set.connecttimeout = (unsigned int)uarg;
|
||||
break;
|
||||
|
||||
#ifndef CURL_DISABLE_FTP
|
||||
@ -3010,10 +3008,10 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
||||
data->set.suppress_connect_headers = (0 != va_arg(param, long))?TRUE:FALSE;
|
||||
break;
|
||||
case CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS:
|
||||
arg = va_arg(param, long);
|
||||
if(arg < 0)
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
data->set.happy_eyeballs_timeout = arg;
|
||||
uarg = va_arg(param, unsigned long);
|
||||
if(uarg >= UINT_MAX)
|
||||
uarg = UINT_MAX;
|
||||
data->set.happy_eyeballs_timeout = (unsigned int)uarg;
|
||||
break;
|
||||
#ifndef CURL_DISABLE_SHUFFLE_DNS
|
||||
case CURLOPT_DNS_SHUFFLE_ADDRESSES:
|
||||
|
@ -1695,10 +1695,10 @@ struct UserDefined {
|
||||
#endif
|
||||
void *progress_client; /* pointer to pass to the progress callback */
|
||||
void *ioctl_client; /* pointer to pass to the ioctl callback */
|
||||
long timeout; /* in milliseconds, 0 means no timeout */
|
||||
long connecttimeout; /* in milliseconds, 0 means no timeout */
|
||||
long happy_eyeballs_timeout; /* in milliseconds, 0 is a valid value */
|
||||
long server_response_timeout; /* in milliseconds, 0 means no timeout */
|
||||
unsigned int timeout; /* ms, 0 means no timeout */
|
||||
unsigned int connecttimeout; /* ms, 0 means no timeout */
|
||||
unsigned int happy_eyeballs_timeout; /* ms, 0 is a valid value */
|
||||
unsigned int server_response_timeout; /* ms, 0 means no timeout */
|
||||
long maxage_conn; /* in seconds, max idle time to allow a connection that
|
||||
is to be reused */
|
||||
long maxlifetime_conn; /* in seconds, max time since creation to allow a
|
||||
|
Loading…
x
Reference in New Issue
Block a user