MCPcopy Create free account
hub / github.com/caozhiyi/CppNet / OnRequest

Method OnRequest

test/http/HttpServer.cpp:55–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55void 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

Callers

nothing calls this directly

Calls 6

GetHeaderMethod · 0.80
GetVersionMethod · 0.80
GetSendBufferMethod · 0.80
GetCloseConnectionMethod · 0.80
CloseMethod · 0.80
WriteMethod · 0.45

Tested by

no test coverage detected