| 407 | } |
| 408 | |
| 409 | int phr_parse_response(const char *buf_start, size_t len, int *minor_version, |
| 410 | int *status, const char **msg, size_t *msg_len, |
| 411 | struct phr_header *headers, size_t *num_headers, |
| 412 | size_t last_len) { |
| 413 | const char *buf = buf_start, *buf_end = buf + len; |
| 414 | size_t max_headers = *num_headers; |
| 415 | int r; |
| 416 | |
| 417 | *minor_version = -1; |
| 418 | *status = 0; |
| 419 | *msg = NULL; |
| 420 | *msg_len = 0; |
| 421 | *num_headers = 0; |
| 422 | |
| 423 | /* if last_len != 0, check if the response is complete (a fast countermeasure |
| 424 | against slowloris */ |
| 425 | if (last_len != 0 && is_complete(buf, buf_end, last_len, &r) == NULL) { |
| 426 | return r; |
| 427 | } |
| 428 | |
| 429 | if ((buf = parse_response(buf, buf_end, minor_version, status, msg, msg_len, |
| 430 | headers, num_headers, max_headers, &r)) == NULL) { |
| 431 | return r; |
| 432 | } |
| 433 | |
| 434 | return (int)(buf - buf_start); |
| 435 | } |
| 436 | |
| 437 | int phr_parse_headers(const char *buf_start, size_t len, |
| 438 | struct phr_header *headers, size_t *num_headers, |
nothing calls this directly
no test coverage detected