mirror of
https://github.com/curl/curl.git
synced 2026-08-25 12:13:37 +03:00
curl: timeout in the read callback
The read callback can timeout if there's nothing to read within the given maximum period. Example use case is when doing "curl -m 3 telnet://example.com" or anything else that expects input on stdin or similar that otherwise would "hang" until something happens and then not respect the timeout. This fixes KNOWN_BUG 8.1, first filed in July 2009. Bug: https://sourceforge.net/p/curl/bugs/846/ Closes #9815
This commit is contained in:
parent
b830f9ba9e
commit
a55256cfb2
9 changed files with 58 additions and 29 deletions
|
|
@ -240,8 +240,9 @@ static ParameterError str2double(double *val, const char *str, double max)
|
|||
}
|
||||
|
||||
/*
|
||||
* Parse the string and write the double in the given address. Return PARAM_OK
|
||||
* on success, otherwise a parameter error enum. ONLY ACCEPTS POSITIVE NUMBERS!
|
||||
* Parse the string as seconds with decimals, and write the number of
|
||||
* milliseconds that corresponds in the given address. Return PARAM_OK on
|
||||
* success, otherwise a parameter error enum. ONLY ACCEPTS POSITIVE NUMBERS!
|
||||
*
|
||||
* The 'max' argument is the maximum value allowed, as the numbers are often
|
||||
* multiplied when later used.
|
||||
|
|
@ -251,16 +252,16 @@ static ParameterError str2double(double *val, const char *str, double max)
|
|||
* data.
|
||||
*/
|
||||
|
||||
ParameterError str2udouble(double *valp, const char *str, double max)
|
||||
ParameterError secs2ms(long *valp, const char *str)
|
||||
{
|
||||
double value;
|
||||
ParameterError result = str2double(&value, str, max);
|
||||
ParameterError result = str2double(&value, str, (double)LONG_MAX/1000);
|
||||
if(result != PARAM_OK)
|
||||
return result;
|
||||
if(value < 0)
|
||||
return PARAM_NEGATIVE_NUMERIC;
|
||||
|
||||
*valp = value;
|
||||
*valp = (long)(value*1000);
|
||||
return PARAM_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue