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

Function responseWriteBuffer

src/Server/StaticRequestHandler.cpp:63–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61};
62
63static inline ResponseOutput responseWriteBuffer(HTTPServerRequest & request, HTTPServerResponse & response)
64{
65 auto result = ResponseOutput(std::make_unique<WriteBufferFromHTTPServerResponse>(response, request.getMethod() == HTTPRequest::HTTP_HEAD));
66
67 /// The client can pass a HTTP header indicating supported compression method (gzip or deflate).
68 String http_response_compression_methods = request.get("Accept-Encoding", "");
69 CompressionMethod http_response_compression_method = CompressionMethod::None;
70
71 if (!http_response_compression_methods.empty())
72 http_response_compression_method = chooseHTTPCompressionMethod(http_response_compression_methods);
73
74 if (http_response_compression_method == CompressionMethod::None)
75 return result;
76
77 response.set("Content-Encoding", toContentEncodingName(http_response_compression_method));
78 result.setCompressedOut(wrapWriteBufferWithCompressionMethod(result.get(), http_response_compression_method, 1, 0));
79
80 return result;
81}
82
83void StaticRequestHandler::handleRequest(HTTPServerRequest & request, HTTPServerResponse & response, const ProfileEvents::Event & /*write_event*/)
84{

Callers 1

handleRequestMethod · 0.85

Calls 8

ResponseOutputClass · 0.85
toContentEncodingNameFunction · 0.85
setCompressedOutMethod · 0.80
getMethod · 0.45
emptyMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected