| 3449 | } |
| 3450 | |
| 3451 | inline bool read_headers(Stream &strm, Headers &headers) { |
| 3452 | const auto bufsiz = 2048; |
| 3453 | char buf[bufsiz]; |
| 3454 | stream_line_reader line_reader(strm, buf, bufsiz); |
| 3455 | |
| 3456 | for (;;) { |
| 3457 | if (!line_reader.getline()) { return false; } |
| 3458 | |
| 3459 | // Check if the line ends with CRLF. |
| 3460 | auto line_terminator_len = 2; |
| 3461 | if (line_reader.end_with_crlf()) { |
| 3462 | // Blank line indicates end of headers. |
| 3463 | if (line_reader.size() == 2) { break; } |
| 3464 | #ifdef CPPHTTPLIB_ALLOW_LF_AS_LINE_TERMINATOR |
| 3465 | } else { |
| 3466 | // Blank line indicates end of headers. |
| 3467 | if (line_reader.size() == 1) { break; } |
| 3468 | line_terminator_len = 1; |
| 3469 | } |
| 3470 | #else |
| 3471 | } else { |
| 3472 | continue; // Skip invalid line. |
| 3473 | } |
| 3474 | #endif |
| 3475 | |
| 3476 | if (line_reader.size() > CPPHTTPLIB_HEADER_MAX_LENGTH) { return false; } |
no test coverage detected