| 53 | } |
| 54 | |
| 55 | void CHttpServer::OnRequest(const cppnet::Handle& handle, const CHttpRequest& req) { |
| 56 | const std::string& connection = req.GetHeader("Connection"); |
| 57 | bool close = connection == "close" || |
| 58 | (req.GetVersion() == Http10 && connection != "Keep-Alive"); |
| 59 | |
| 60 | CHttpResponse response(close); |
| 61 | _http_call_back(req, response); |
| 62 | |
| 63 | std::string res = response.GetSendBuffer(); |
| 64 | handle->Write(res.c_str(), res.length()); |
| 65 | if (response.GetCloseConnection()) { |
| 66 | handle->Close(); |
| 67 | } |
| 68 | } |
| 69 |
nothing calls this directly
no test coverage detected