mirror of
https://github.com/yhirose/cpp-httplib
synced 2024-11-21 06:26:02 -07:00
Fix logger never called when write_content_with_provider returns false (#549)
This commit is contained in:
parent
bad6b2d22f
commit
887def9490
1 changed files with 4 additions and 3 deletions
|
@ -3908,13 +3908,14 @@ inline bool Server::write_response(Stream &strm, bool close_connection,
|
|||
strm.write(data.data(), data.size());
|
||||
|
||||
// Body
|
||||
auto ret = true;
|
||||
if (req.method != "HEAD") {
|
||||
if (!res.body.empty()) {
|
||||
if (!strm.write(res.body)) { return false; }
|
||||
if (!strm.write(res.body)) { ret = false; }
|
||||
} else if (res.content_provider_) {
|
||||
if (!write_content_with_provider(strm, req, res, boundary,
|
||||
content_type)) {
|
||||
return false;
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3922,7 +3923,7 @@ inline bool Server::write_response(Stream &strm, bool close_connection,
|
|||
// Log
|
||||
if (logger_) { logger_(req, res); }
|
||||
|
||||
return true;
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline bool
|
||||
|
|
Loading…
Reference in a new issue