MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / read_headers

Function read_headers

examples/server/httplib.h:3451–3473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3449}
3450
3451inline 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; }

Callers 1

process_requestMethod · 0.85

Calls 3

getlineMethod · 0.80
end_with_crlfMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected