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

Function tryAddHTTPOptionHeadersFromConfig

src/Server/HTTPHandler.cpp:93–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91namespace
92{
93bool tryAddHTTPOptionHeadersFromConfig(HTTPServerResponse & response, const Poco::Util::LayeredConfiguration & config)
94{
95 if (config.has("http_options_response"))
96 {
97 Strings config_keys;
98 config.keys("http_options_response", config_keys);
99 for (const std::string & config_key : config_keys)
100 {
101 if (config_key == "header" || config_key.starts_with("header["))
102 {
103 /// If there is empty header name, it will not be processed and message about it will be in logs
104 if (config.getString("http_options_response." + config_key + ".name", "").empty())
105 LOG_WARNING(getLogger("processOptionsRequest"), "Empty header was found in config. It will not be processed.");
106 else
107 response.add(config.getString("http_options_response." + config_key + ".name", ""),
108 config.getString("http_options_response." + config_key + ".value", ""));
109
110 }
111 }
112 return true;
113 }
114 return false;
115}
116
117/// Process options request. Useful for CORS.
118void processOptionsRequest(HTTPServerResponse & response, const Poco::Util::LayeredConfiguration & config)

Callers 2

processOptionsRequestFunction · 0.85
handleRequestMethod · 0.85

Calls 6

keysMethod · 0.80
getLoggerFunction · 0.50
hasMethod · 0.45
emptyMethod · 0.45
getStringMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected