mirror of
https://github.com/curl/curl.git
synced 2026-08-25 07:03:31 +03:00
strparse: switch to curl_off_t as base data type
- add hex and octal parsers to the Curl_str_* family - make curlx_strtoofft use these parsers - remove all use of strtol() and strtoul() in library code - generally use Curl_str_* more than strtoofft, for stricter parsing - supports 64-bit universally, instead of 'long' which differs in size between platforms Extended the unit test 1664 to verify hex and octal parsing. Closes #16336
This commit is contained in:
parent
876db1070b
commit
b4538ec522
46 changed files with 538 additions and 497 deletions
10
lib/http.c
10
lib/http.c
|
|
@ -86,6 +86,7 @@
|
|||
#include "hsts.h"
|
||||
#include "ws.h"
|
||||
#include "curl_ctype.h"
|
||||
#include "strparse.h"
|
||||
|
||||
/* The last 3 #include files should be in this order */
|
||||
#include "curl_printf.h"
|
||||
|
|
@ -3072,11 +3073,10 @@ static CURLcode http_header(struct Curl_easy *data,
|
|||
|
||||
/* if it truly stopped on a digit */
|
||||
if(ISDIGIT(*ptr)) {
|
||||
if(!curlx_strtoofft(ptr, NULL, 10, &k->offset)) {
|
||||
if(data->state.resume_from == k->offset)
|
||||
/* we asked for a resume and we got it */
|
||||
k->content_range = TRUE;
|
||||
}
|
||||
if(!Curl_str_number(&ptr, &k->offset, CURL_OFF_T_MAX) &&
|
||||
(data->state.resume_from == k->offset))
|
||||
/* we asked for a resume and we got it */
|
||||
k->content_range = TRUE;
|
||||
}
|
||||
else if(k->httpcode < 300)
|
||||
data->state.resume_from = 0; /* get everything */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue