Prior to this change chunks were handled correctly although in verbose
mode libcurl could incorrectly warn of "Leftovers after chunking" even
if there were none.
Reported-by: Michael Kaufmann
Fixes https://github.com/curl/curl/issues/12937
Closes https://github.com/curl/curl/pull/12939
ch->hexbuffer[ch->hexindex++] = *buf;
buf++;
blen--;
+ (*pconsumed)++;
}
else {
char *endptr;
buf++;
blen--;
+ (*pconsumed)++;
break;
case CHUNK_DATA:
}
buf++;
blen--;
+ (*pconsumed)++;
break;
case CHUNK_TRAILER:
}
buf++;
blen--;
+ (*pconsumed)++;
break;
case CHUNK_TRAILER_CR:
ch->state = CHUNK_TRAILER_POSTCR;
buf++;
blen--;
+ (*pconsumed)++;
}
else {
ch->state = CHUNK_FAILED;
/* skip if CR */
buf++;
blen--;
+ (*pconsumed)++;
}
/* now wait for the final LF */
ch->state = CHUNK_STOP;
case CHUNK_STOP:
if(*buf == 0x0a) {
blen--;
+ (*pconsumed)++;
/* Record the length of any data left in the end of the buffer
even if there's no more chunks to read */
ch->datasize = blen;