MCPcopy Create free account
hub / github.com/NetSys/bess / phr_parse_headers

Function phr_parse_headers

core/utils/http_parser.cc:437–458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

435}
436
437int phr_parse_headers(const char *buf_start, size_t len,
438 struct phr_header *headers, size_t *num_headers,
439 size_t last_len) {
440 const char *buf = buf_start, *buf_end = buf + len;
441 size_t max_headers = *num_headers;
442 int r;
443
444 *num_headers = 0;
445
446 /* if last_len != 0, check if the response is complete (a fast countermeasure
447 against slowloris */
448 if (last_len != 0 && is_complete(buf, buf_end, last_len, &r) == NULL) {
449 return r;
450 }
451
452 if ((buf = parse_headers(buf, buf_end, headers, num_headers, max_headers,
453 &r)) == NULL) {
454 return r;
455 }
456
457 return (int)(buf - buf_start);
458}
459
460enum {
461 CHUNKED_IN_CHUNK_SIZE,

Callers

nothing calls this directly

Calls 2

is_completeFunction · 0.85
parse_headersFunction · 0.85

Tested by

no test coverage detected