| 435 | } |
| 436 | |
| 437 | int 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 | |
| 460 | enum { |
| 461 | CHUNKED_IN_CHUNK_SIZE, |
nothing calls this directly
no test coverage detected