mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Merge pull request #240 from vavrusa/master
HTTPHandler: added support for X-ClickHouse-*
This commit is contained in:
commit
52c34b4276
@ -91,8 +91,9 @@ void HTTPHandler::processQuery(
|
||||
used_output.out_maybe_compressed = used_output.out;
|
||||
|
||||
/// Имя пользователя и пароль могут быть заданы как в параметрах URL, так и с помощью HTTP Basic authentification (и то, и другое не секъюрно).
|
||||
std::string user = params.get("user", "default");
|
||||
std::string password = params.get("password", "");
|
||||
/// The user and password can be passed by headers (similar to X-Auth-*), which is used by load balancers to pass authentication information
|
||||
std::string user = request.get("X-ClickHouse-User", params.get("user", "default"));
|
||||
std::string password = request.get("X-ClickHouse-Key", params.get("password", ""));
|
||||
|
||||
if (request.hasCredentials())
|
||||
{
|
||||
@ -102,7 +103,7 @@ void HTTPHandler::processQuery(
|
||||
password = credentials.getPassword();
|
||||
}
|
||||
|
||||
std::string quota_key = params.get("quota_key", "");
|
||||
std::string quota_key = request.get("X-ClickHouse-Quota", params.get("quota_key", ""));
|
||||
std::string query_id = params.get("query_id", "");
|
||||
|
||||
Context context = *server.global_context;
|
||||
|
@ -728,6 +728,10 @@ echo 'SELECT 1' | curl 'http://user:password@localhost:8123/' -d
|
||||
<pre class="terminal">
|
||||
echo 'SELECT 1' | curl 'http://localhost:8123/?user=user&password=password' -d @-
|
||||
</pre>
|
||||
3. Using 'X-ClickHouse-User' and 'X-ClickHouse-Key' headers. Example:
|
||||
<pre class="terminal">
|
||||
echo 'SELECT 1' | curl -H "X-ClickHouse-User: user" -H "X-ClickHouse-Key: password" 'http://localhost:8123/' -d @-
|
||||
</pre>
|
||||
If the user name is not indicated, the username 'default' is used. If the password is not indicated, an empty password is used.
|
||||
|
||||
|
||||
@ -757,7 +761,7 @@ In contrast to the native interface, the HTTP interface does not support the con
|
||||
|
||||
The optional 'query_id' parameter can be passed as the query ID (any string). For more information, see the section "Settings, replace_running_query".
|
||||
|
||||
The optional 'quota_key' parameter can be passed as the quota key (any string). For more information, see the section "Quotas".
|
||||
The optional 'quota_key' parameter can be passed as the quota key (any string). It can also be passed as 'X-ClickHouse-Quota' header. For more information, see the section "Quotas".
|
||||
|
||||
The HTTP interface allows passing external data (external temporary tables) for querying. For more information, see the section "External data for query processing".
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user