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

Method read_content

dependencies/httplib/httplib.h:5169–5201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5167}
5168
5169inline bool Server::read_content(Stream &strm, Request &req, Response &res) {
5170 MultipartFormDataMap::iterator cur;
5171 if (read_content_core(
5172 strm, req, res,
5173 // Regular
5174 [&](const char *buf, size_t n) {
5175 if (req.body.size() + n > req.body.max_size()) { return false; }
5176 req.body.append(buf, n);
5177 return true;
5178 },
5179 // Multipart
5180 [&](const MultipartFormData &file) {
5181 cur = req.files.emplace(file.name, file);
5182 return true;
5183 },
5184 [&](const char *buf, size_t n) {
5185 auto &content = cur->second.content;
5186 if (content.size() + n > content.max_size()) { return false; }
5187 content.append(buf, n);
5188 return true;
5189 })) {
5190 const auto &content_type = req.get_header_value("Content-Type");
5191 if (!content_type.find("application/x-www-form-urlencoded")) {
5192 if (req.body.size() > CPPHTTPLIB_REQUEST_URI_MAX_LENGTH) {
5193 res.status = 413; // NOTE: should be 414?
5194 return false;
5195 }
5196 detail::parse_query_text(req.body, req.params);
5197 }
5198 return true;
5199 }
5200 return false;
5201}
5202
5203inline bool Server::read_content_with_content_receiver(
5204 Stream &strm, Request &req, Response &res, ContentReceiver receiver,

Callers

nothing calls this directly

Calls 6

parse_query_textFunction · 0.85
get_header_valueMethod · 0.80
sizeMethod · 0.45
appendMethod · 0.45
emplaceMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected