mirror of
https://github.com/moparisthebest/curl
synced 2024-11-05 09:05:04 -05:00
http_chunks: correct and clarify a comment on hexnumber length
... and also rename the define for max length. Closes #6489
This commit is contained in:
parent
e71542a9d9
commit
13bc1ea9bc
@ -137,7 +137,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
|
|||||||
switch(ch->state) {
|
switch(ch->state) {
|
||||||
case CHUNK_HEX:
|
case CHUNK_HEX:
|
||||||
if(isxdigit_ascii(*datap)) {
|
if(isxdigit_ascii(*datap)) {
|
||||||
if(ch->hexindex < MAXNUM_SIZE) {
|
if(ch->hexindex < CHUNK_MAXNUM_LEN) {
|
||||||
ch->hexbuffer[ch->hexindex] = *datap;
|
ch->hexbuffer[ch->hexindex] = *datap;
|
||||||
datap++;
|
datap++;
|
||||||
length--;
|
length--;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -26,10 +26,10 @@ struct connectdata;
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* The longest possible hexadecimal number we support in a chunked transfer.
|
* The longest possible hexadecimal number we support in a chunked transfer.
|
||||||
* Weird enough, RFC2616 doesn't set a maximum size! Since we use strtoul()
|
* Neither RFC2616 nor the later HTTP specs define a maximum chunk size.
|
||||||
* to convert it, we "only" support 2^32 bytes chunk data.
|
* For 64 bit curl_off_t we support 16 digits. For 32 bit, 8 digits.
|
||||||
*/
|
*/
|
||||||
#define MAXNUM_SIZE 16
|
#define CHUNK_MAXNUM_LEN (SIZEOF_CURL_OFF_T * 2)
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
/* await and buffer all hexadecimal digits until we get one that isn't a
|
/* await and buffer all hexadecimal digits until we get one that isn't a
|
||||||
@ -83,7 +83,7 @@ typedef enum {
|
|||||||
const char *Curl_chunked_strerror(CHUNKcode code);
|
const char *Curl_chunked_strerror(CHUNKcode code);
|
||||||
|
|
||||||
struct Curl_chunker {
|
struct Curl_chunker {
|
||||||
char hexbuffer[ MAXNUM_SIZE + 1];
|
char hexbuffer[ CHUNK_MAXNUM_LEN + 1]; /* +1 for null-terminator */
|
||||||
int hexindex;
|
int hexindex;
|
||||||
ChunkyState state;
|
ChunkyState state;
|
||||||
curl_off_t datasize;
|
curl_off_t datasize;
|
||||||
|
Loading…
Reference in New Issue
Block a user