-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy patherror.cpp
More file actions
28 lines (22 loc) · 747 Bytes
/
error.cpp
File metadata and controls
28 lines (22 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "error.hpp"
namespace webcpp {
error::error(Poco::Net::HTTPServerResponse::HTTPStatus status, const std::string& message) : resStatus(status), message(message) {
}
void error::handleRequest(Poco::Net::HTTPServerRequest& req, Poco::Net::HTTPServerResponse& res) {
res.setChunkedTransferEncoding(true);
res.setStatusAndReason(this->resStatus);
res.setContentType("text/html");
std::ostream& os = res.send();
os << "<html><head><title>"
<< static_cast<int> (res.getStatus())
<< " "
<< res.getReason()
<< "</title><body bgcolor=\"white\"><center><h1>"
<< static_cast<int> (res.getStatus())
<< " "
<< res.getReason()
<< "</h1></center><hr/>"
<< this->message
<< "</body></html>";
}
}