MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / handleRequest

Method handleRequest

src/Server/KeeperJemallocHandler.cpp:34–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32{
33
34void KeeperJemallocWebUIHandler::handleRequest(
35 HTTPServerRequest & request, HTTPServerResponse & response, const ProfileEvents::Event &)
36{
37 std::string html(reinterpret_cast<const char *>(resource_jemalloc_html), std::size(resource_jemalloc_html));
38
39 constexpr std::string_view head_close = "<head>";
40 auto pos = html.find(head_close);
41 if (pos != std::string::npos)
42 html.insert(pos + head_close.size(), "<script>window.JEMALLOC_CONFIG={mode:'keeper'}</script>");
43
44 response.setContentType("text/html; charset=UTF-8");
45 if (request.getVersion() == HTTPServerRequest::HTTP_1_1)
46 response.setChunkedTransferEncoding(true);
47
48 setResponseDefaultHeaders(response);
49 response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_OK);
50 auto wb = WriteBufferFromHTTPServerResponse(response, request.getMethod() == HTTPRequest::HTTP_HEAD);
51 wb.write(html.data(), html.size());
52 wb.finalize();
53}
54
55void KeeperJemallocRedirectHandler::handleRequest(
56 HTTPServerRequest &, HTTPServerResponse & response, const ProfileEvents::Event &)

Callers

nothing calls this directly

Calls 15

checkProfilingEnabledFunction · 0.85
flushProfileFunction · 0.85
readStringUntilEOFFunction · 0.85
getStatsFunction · 0.85
tryGetValueFunction · 0.85
setStatusAndReasonMethod · 0.80
getURIMethod · 0.80

Tested by

no test coverage detected