| 3251 | } |
| 3252 | |
| 3253 | inline bool read_headers(Stream &strm, Headers &headers) { |
| 3254 | const auto bufsiz = 2048; |
| 3255 | char buf[bufsiz]; |
| 3256 | stream_line_reader line_reader(strm, buf, bufsiz); |
| 3257 | |
| 3258 | for (;;) { |
| 3259 | if (!line_reader.getline()) { return false; } |
| 3260 | |
| 3261 | // Check if the line ends with CRLF. |
| 3262 | auto line_terminator_len = 2; |
| 3263 | if (line_reader.end_with_crlf()) { |
| 3264 | // Blank line indicates end of headers. |
| 3265 | if (line_reader.size() == 2) { break; } |
| 3266 | #ifdef CPPHTTPLIB_ALLOW_LF_AS_LINE_TERMINATOR |
| 3267 | } else { |
| 3268 | // Blank line indicates end of headers. |
| 3269 | if (line_reader.size() == 1) { break; } |
| 3270 | line_terminator_len = 1; |
| 3271 | } |
| 3272 | #else |
| 3273 | } else { |
| 3274 | continue; // Skip invalid line. |
| 3275 | } |
| 3276 | #endif |
| 3277 | |
| 3278 | if (line_reader.size() > CPPHTTPLIB_HEADER_MAX_LENGTH) { return false; } |
no test coverage detected