summaryrefslogtreecommitdiff
path: root/lib/http_chunks.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/http_chunks.c')
-rw-r--r--lib/http_chunks.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/http_chunks.c b/lib/http_chunks.c
index 8368eeca6..18dfcb282 100644
--- a/lib/http_chunks.c
+++ b/lib/http_chunks.c
@@ -74,6 +74,19 @@
*/
+#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_ascii(char digit)
+{
+ return (digit >= 0x30 && digit <= 0x39) /* 0-9 */
+ || (digit >= 0x41 && digit <= 0x46) /* A-F */
+ || (digit >= 0x61 && digit <= 0x66); /* a-f */
+}
+#else
+#define Curl_isxdigit_ascii(x) Curl_isxdigit(x)
+#endif
+
void Curl_httpchunk_init(struct connectdata *conn)
{
struct Curl_chunker *chunk = &conn->chunk;
@@ -119,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++;