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

Function process_multipart_ranges_data

dependencies/httplib/httplib.h:4057–4089  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4055
4056template <typename SToken, typename CToken, typename Content>
4057bool process_multipart_ranges_data(const Request &req, Response &res,
4058 const std::string &boundary,
4059 const std::string &content_type,
4060 SToken stoken, CToken ctoken,
4061 Content content) {
4062 for (size_t i = 0; i < req.ranges.size(); i++) {
4063 ctoken("--");
4064 stoken(boundary);
4065 ctoken("\r\n");
4066 if (!content_type.empty()) {
4067 ctoken("Content-Type: ");
4068 stoken(content_type);
4069 ctoken("\r\n");
4070 }
4071
4072 auto offsets = get_range_offset_and_length(req, res.body.size(), i);
4073 auto offset = offsets.first;
4074 auto length = offsets.second;
4075
4076 ctoken("Content-Range: ");
4077 stoken(make_content_range_header_field(offset, length, res.body.size()));
4078 ctoken("\r\n");
4079 ctoken("\r\n");
4080 if (!content(offset, length)) { return false; }
4081 ctoken("\r\n");
4082 }
4083
4084 ctoken("--");
4085 stoken(boundary);
4086 ctoken("--\r\n");
4087
4088 return true;
4089}
4090
4091inline bool make_multipart_ranges_data(const Request &req, Response &res,
4092 const std::string &boundary,

Callers 3

Calls 4

sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected