mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-15 01:08:27 +00:00
Fix #1437
This commit is contained in:
parent
5758769ad3
commit
9d0a9d4e23
2 changed files with 30 additions and 8 deletions
11
httplib.h
11
httplib.h
|
@ -5855,7 +5855,16 @@ Server::process_request(Stream &strm, bool close_connection,
|
|||
routed = true;
|
||||
} else {
|
||||
res.status = 500;
|
||||
res.set_header("EXCEPTION_WHAT", e.what());
|
||||
std::string val;
|
||||
auto s = e.what();
|
||||
for (size_t i = 0; s[i]; i++) {
|
||||
switch (s[i]) {
|
||||
case '\r': val += "\\r"; break;
|
||||
case '\n': val += "\\n"; break;
|
||||
default: val += s[i]; break;
|
||||
}
|
||||
}
|
||||
res.set_header("EXCEPTION_WHAT", val);
|
||||
}
|
||||
} catch (...) {
|
||||
if (exception_handler_) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue