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

Method handleRequest

src/Server/IndexRequestHandler.cpp:22–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22void IndexRequestHandler::handleRequest(HTTPServerRequest & request, HTTPServerResponse & response, const ProfileEvents::Event & write_event)
23{
24 /// If it looks like a browser:
25 if (request.get("User-Agent", "").starts_with("Mozilla"))
26 {
27 applyHTTPResponseHeaders(response, http_response_headers_override);
28 response.setContentType("text/html; charset=UTF-8");
29 if (request.getVersion() == HTTPServerRequest::HTTP_1_1)
30 response.setChunkedTransferEncoding(true);
31
32 setResponseDefaultHeaders(response);
33 response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_OK);
34 auto wb = WriteBufferFromHTTPServerResponse(response, request.getMethod() == HTTPRequest::HTTP_HEAD);
35 wb.write(reinterpret_cast<const char *>(resource_index_html), std::size(resource_index_html));
36 wb.finalize();
37 }
38 else
39 {
40 StaticRequestHandler(server, "Ok.\n", parseHTTPResponseHeaders("text/html; charset=UTF-8")).handleRequest(request, response, write_event);
41 }
42}
43
44}

Callers

nothing calls this directly

Calls 13

applyHTTPResponseHeadersFunction · 0.85
parseHTTPResponseHeadersFunction · 0.85
setStatusAndReasonMethod · 0.80
sizeFunction · 0.50
getMethod · 0.45
setContentTypeMethod · 0.45
getVersionMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected