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

Function read_content

dependencies/httplib/httplib.h:3438–3465  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3436
3437template <typename T>
3438bool read_content(Stream &strm, T &x, size_t payload_max_length, int &status,
3439 Progress progress, ContentReceiverWithProgress receiver,
3440 bool decompress) {
3441 return prepare_content_receiver(
3442 x, status, std::move(receiver), decompress,
3443 [&](const ContentReceiverWithProgress &out) {
3444 auto ret = true;
3445 auto exceed_payload_max_length = false;
3446
3447 if (is_chunked_transfer_encoding(x.headers)) {
3448 ret = read_content_chunked(strm, out);
3449 } else if (!has_header(x.headers, "Content-Length")) {
3450 ret = read_content_without_length(strm, out);
3451 } else {
3452 auto len = get_header_value<uint64_t>(x.headers, "Content-Length");
3453 if (len > payload_max_length) {
3454 exceed_payload_max_length = true;
3455 skip_content_with_length(strm, len);
3456 ret = false;
3457 } else if (len > 0) {
3458 ret = read_content_with_length(strm, len, std::move(progress), out);
3459 }
3460 }
3461
3462 if (!ret) { status = exceed_payload_max_length ? 413 : 400; }
3463 return ret;
3464 });
3465} // namespace detail
3466
3467inline ssize_t write_headers(Stream &strm, const Headers &headers) {
3468 ssize_t write_len = 0;

Callers 3

read_content_coreMethod · 0.85
routingMethod · 0.85
process_requestMethod · 0.85

Calls 7

prepare_content_receiverFunction · 0.85
read_content_chunkedFunction · 0.85
has_headerFunction · 0.85
skip_content_with_lengthFunction · 0.85
read_content_with_lengthFunction · 0.85

Tested by

no test coverage detected