mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 02:21:59 +00:00
Added support for HTTP compression [#METR-20041].
This commit is contained in:
parent
c7d394f47e
commit
421d5a97ad
@ -58,7 +58,7 @@ private:
|
||||
|
||||
response_ostr = &response.send();
|
||||
deflating_stream.emplace(*response_ostr, compression_method);
|
||||
ostr = &deflating_stream;
|
||||
ostr = &deflating_stream.value();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -52,9 +52,9 @@ void HTTPHandler::processQuery(Poco::Net::HTTPServerRequest & request, Poco::Net
|
||||
|
||||
/** Клиент может указать поддерживаемый метод сжатия (gzip или deflate) в HTTP-заголовке.
|
||||
*/
|
||||
String http_compression_methods = request.get("Accept-Encoding");
|
||||
String http_compression_methods = request.get("Accept-Encoding", "");
|
||||
bool http_compress = false;
|
||||
Poco::DeflatingStreamBuf::StreamType http_compression_method;
|
||||
Poco::DeflatingStreamBuf::StreamType http_compression_method {};
|
||||
|
||||
if (!http_compression_methods.empty())
|
||||
{
|
||||
|
@ -0,0 +1,43 @@
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
< Content-Encoding: gzip
|
||||
< Content-Encoding: deflate
|
||||
< Content-Encoding: gzip
|
12
dbms/tests/queries/0_stateless/00302_http_compression.sh
Executable file
12
dbms/tests/queries/0_stateless/00302_http_compression.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
curl -sS 'http://localhost:8123/' -d 'SELECT number FROM system.numbers LIMIT 10';
|
||||
curl -sS 'http://localhost:8123/' -H 'Accept-Encoding: gzip' -d 'SELECT number FROM system.numbers LIMIT 10' | gzip -d;
|
||||
curl -sS 'http://localhost:8123/' -H 'Accept-Encoding: gzip, deflate' -d 'SELECT number FROM system.numbers LIMIT 10' | gzip -d;
|
||||
curl -sS 'http://localhost:8123/' -H 'Accept-Encoding: zip, eflate' -d 'SELECT number FROM system.numbers LIMIT 10';
|
||||
|
||||
curl -vsS 'http://localhost:8123/' -d 'SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep --text '< Content-Encoding';
|
||||
curl -vsS 'http://localhost:8123/' -H 'Accept-Encoding: gzip' -d 'SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep --text '< Content-Encoding';
|
||||
curl -vsS 'http://localhost:8123/' -H 'Accept-Encoding: deflate' -d 'SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep --text '< Content-Encoding';
|
||||
curl -vsS 'http://localhost:8123/' -H 'Accept-Encoding: gzip, deflate' -d 'SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep --text '< Content-Encoding';
|
||||
curl -vsS 'http://localhost:8123/' -H 'Accept-Encoding: zip, eflate' -d 'SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep --text '< Content-Encoding';
|
Loading…
Reference in New Issue
Block a user