diff options
Diffstat (limited to 'libs/libcurl/src/http_chunks.c')
-rw-r--r-- | libs/libcurl/src/http_chunks.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/libs/libcurl/src/http_chunks.c b/libs/libcurl/src/http_chunks.c index 1616429693..18dfcb2824 100644 --- a/libs/libcurl/src/http_chunks.c +++ b/libs/libcurl/src/http_chunks.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -74,14 +74,18 @@ */ +#ifdef CURL_DOES_CONVERSIONS /* Check for an ASCII hex digit. - We avoid the use of isxdigit to accommodate non-ASCII hosts. */ -static bool Curl_isxdigit(char digit) + We avoid the use of ISXDIGIT to accommodate non-ASCII hosts. */ +static bool Curl_isxdigit_ascii(char digit) { - return ( (digit >= 0x30 && digit <= 0x39) /* 0-9 */ + return (digit >= 0x30 && digit <= 0x39) /* 0-9 */ || (digit >= 0x41 && digit <= 0x46) /* A-F */ - || (digit >= 0x61 && digit <= 0x66) /* a-f */) ? TRUE : FALSE; + || (digit >= 0x61 && digit <= 0x66); /* a-f */ } +#else +#define Curl_isxdigit_ascii(x) Curl_isxdigit(x) +#endif void Curl_httpchunk_init(struct connectdata *conn) { @@ -128,7 +132,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn, while(length) { switch(ch->state) { case CHUNK_HEX: - if(Curl_isxdigit(*datap)) { + if(Curl_isxdigit_ascii(*datap)) { if(ch->hexindex < MAXNUM_SIZE) { ch->hexbuffer[ch->hexindex] = *datap; datap++; @@ -187,15 +191,15 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn, piece = curlx_sotouz((ch->datasize >= length)?length:ch->datasize); /* Write the data portion available */ - if(conn->data->set.http_ce_skip || !k->writer_stack) { - if(!k->ignorebody) + if(!conn->data->set.http_te_skip && !k->ignorebody) { + if(!conn->data->set.http_ce_skip && k->writer_stack) + result = Curl_unencode_write(conn, k->writer_stack, datap, piece); + else result = Curl_client_write(conn, CLIENTWRITE_BODY, datap, piece); - } - else - result = Curl_unencode_write(conn, k->writer_stack, datap, piece); - if(result) - return CHUNKE_WRITE_ERROR; + if(result) + return CHUNKE_WRITE_ERROR; + } *wrote += piece; ch->datasize -= piece; /* decrease amount left to expect */ |