| 375 | } |
| 376 | |
| 377 | static const char *parse_response(const char *buf, const char *buf_end, |
| 378 | int *minor_version, int *status, |
| 379 | const char **msg, size_t *msg_len, |
| 380 | struct phr_header *headers, |
| 381 | size_t *num_headers, size_t max_headers, |
| 382 | int *ret) { |
| 383 | /* parse "HTTP/1.x" */ |
| 384 | if ((buf = parse_http_version(buf, buf_end, minor_version, ret)) == NULL) { |
| 385 | return NULL; |
| 386 | } |
| 387 | /* skip space */ |
| 388 | if (*buf++ != ' ') { |
| 389 | *ret = -1; |
| 390 | return NULL; |
| 391 | } |
| 392 | /* parse status code */ |
| 393 | if ((buf = parse_int(buf, buf_end, status, ret)) == NULL) { |
| 394 | return NULL; |
| 395 | } |
| 396 | /* skip space */ |
| 397 | if (*buf++ != ' ') { |
| 398 | *ret = -1; |
| 399 | return NULL; |
| 400 | } |
| 401 | /* get message */ |
| 402 | if ((buf = get_token_to_eol(buf, buf_end, msg, msg_len, ret)) == NULL) { |
| 403 | return NULL; |
| 404 | } |
| 405 | |
| 406 | return parse_headers(buf, buf_end, headers, num_headers, max_headers, ret); |
| 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, |
no test coverage detected