| 309 | } |
| 310 | |
| 311 | static const char *parse_request(const char *buf, const char *buf_end, |
| 312 | const char **method, size_t *method_len, |
| 313 | const char **path, size_t *path_len, |
| 314 | int *minor_version, struct phr_header *headers, |
| 315 | size_t *num_headers, size_t max_headers, |
| 316 | int *ret) { |
| 317 | /* skip first empty line (some clients add CRLF after POST content) */ |
| 318 | CHECK_EOF(); |
| 319 | if (*buf == '\015') { |
| 320 | ++buf; |
| 321 | EXPECT_CHAR('\012'); |
| 322 | } else if (*buf == '\012') { |
| 323 | ++buf; |
| 324 | } |
| 325 | |
| 326 | /* parse request line */ |
| 327 | ADVANCE_TOKEN(*method, *method_len); |
| 328 | ++buf; |
| 329 | ADVANCE_TOKEN(*path, *path_len); |
| 330 | ++buf; |
| 331 | if ((buf = parse_http_version(buf, buf_end, minor_version, ret)) == NULL) { |
| 332 | return NULL; |
| 333 | } |
| 334 | if (*buf == '\015') { |
| 335 | ++buf; |
| 336 | EXPECT_CHAR('\012'); |
| 337 | } else if (*buf == '\012') { |
| 338 | ++buf; |
| 339 | } else { |
| 340 | *ret = -1; |
| 341 | return NULL; |
| 342 | } |
| 343 | |
| 344 | return parse_headers(buf, buf_end, headers, num_headers, max_headers, ret); |
| 345 | } |
| 346 | |
| 347 | int phr_parse_request(const char *buf_start, size_t len, const char **method, |
| 348 | size_t *method_len, const char **path, size_t *path_len, |
no test coverage detected