MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / HttpClient_GetChunkLength

Function HttpClient_GetChunkLength

src/Http_Worker.c:459–473  ·  view source on GitHub ↗

RFC 7230, section 4.1 - Chunked Transfer Coding */

Source from the content-addressed store, hash-verified

457
458/* RFC 7230, section 4.1 - Chunked Transfer Coding */
459static int HttpClient_GetChunkLength(const cc_string* line) {
460 int length = 0, i, part;
461
462 for (i = 0; i < line->length; i++)
463 {
464 char c = line->buffer[i];
465 /* RFC 7230, section 4.1.1 - Chunk Extensions */
466 if (c == ';') break;
467
468 part = PackedCol_DeHex(c);
469 if (part == -1) return -1;
470 length = (length << 4) | part;
471 }
472 return length;
473}
474
475/* https://httpwg.org/specs/rfc7230.html */
476static cc_result HttpClient_Process(struct HttpClientState* state, char* buffer, int total) {

Callers 1

HttpClient_ProcessFunction · 0.85

Calls 1

PackedCol_DeHexFunction · 0.85

Tested by

no test coverage detected