mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-15 17:28:29 +00:00
Code cleanup
This commit is contained in:
parent
402d47e2cd
commit
992f3dc690
1 changed files with 10 additions and 11 deletions
21
httplib.h
21
httplib.h
|
@ -4032,17 +4032,16 @@ inline bool Client::process_request(Stream &strm, const Request &req,
|
||||||
|
|
||||||
// Body
|
// Body
|
||||||
if (req.method != "HEAD" && req.method != "CONNECT") {
|
if (req.method != "HEAD" && req.method != "CONNECT") {
|
||||||
ContentReceiver out = [&](const char *buf, size_t n) {
|
auto out =
|
||||||
if (res.body.size() + n > res.body.max_size()) { return false; }
|
req.content_receiver
|
||||||
res.body.append(buf, n);
|
? static_cast<ContentReceiver>([&](const char *buf, size_t n) {
|
||||||
return true;
|
return req.content_receiver(buf, n);
|
||||||
};
|
})
|
||||||
|
: static_cast<ContentReceiver>([&](const char *buf, size_t n) {
|
||||||
if (req.content_receiver) {
|
if (res.body.size() + n > res.body.max_size()) { return false; }
|
||||||
out = [&](const char *buf, size_t n) {
|
res.body.append(buf, n);
|
||||||
return req.content_receiver(buf, n);
|
return true;
|
||||||
};
|
});
|
||||||
}
|
|
||||||
|
|
||||||
int dummy_status;
|
int dummy_status;
|
||||||
if (!detail::read_content(strm, res, (std::numeric_limits<size_t>::max)(),
|
if (!detail::read_content(strm, res, (std::numeric_limits<size_t>::max)(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue