MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / read_headers

Function read_headers

dependencies/httplib/httplib.h:3253–3275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3251}
3252
3253inline 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; }

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