mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Fix an error for POST queries with empty body. [#CLICKHOUSE-3333]
This commit is contained in:
parent
70165b949f
commit
9d3f28f52d
@ -35,6 +35,8 @@
|
||||
#include <Interpreters/Quota.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
|
||||
#include <Poco/Net/HTTPStream.h>
|
||||
|
||||
#include "HTTPHandler.h"
|
||||
|
||||
namespace DB
|
||||
@ -377,7 +379,14 @@ void HTTPHandler::processQuery(
|
||||
|
||||
std::unique_ptr<ReadBuffer> in_param = std::make_unique<ReadBufferFromString>(query_param);
|
||||
|
||||
std::unique_ptr<ReadBuffer> in_post_raw = std::make_unique<ReadBufferFromIStream>(istr);
|
||||
std::unique_ptr<ReadBuffer> in_post_raw;
|
||||
/// A grubby workaround for CLICKHOUSE-3333 problem. This if should detect POST query with empty body.
|
||||
/// In that case Poco doesn't work properly and returns HTTPInputStream which just listen TCP connection.
|
||||
/// NOTE: if Poco are updated, this heuristic might not work properly.
|
||||
if (dynamic_cast<Poco::Net::HTTPInputStream *>(&istr) == nullptr)
|
||||
in_post_raw = std::make_unique<ReadBufferFromIStream>(istr);
|
||||
else
|
||||
in_post_raw = std::make_unique<ReadBufferFromString>(String()); // will read empty body.
|
||||
|
||||
/// Request body can be compressed using algorithm specified in the Content-Encoding header.
|
||||
std::unique_ptr<ReadBuffer> in_post;
|
||||
|
@ -10,3 +10,5 @@ Content-Type: text/tab-separated-values; charset=UTF-8
|
||||
Transfer-Encoding: chunked
|
||||
Keep-Alive: timeout=3
|
||||
|
||||
1
|
||||
1
|
||||
|
@ -2,3 +2,6 @@
|
||||
|
||||
( curl -s --head "${CLICKHOUSE_URL:=http://localhost:8123/}?query=SELECT%201";
|
||||
curl -s --head "${CLICKHOUSE_URL:=http://localhost:8123/}?query=select+*+from+system.numbers+limit+1000000" ) | grep -v "Date:"
|
||||
|
||||
curl -sS -X POST "http://127.0.0.1:8123?query=SELECT+1"
|
||||
curl -sS -X POST "http://127.0.0.1:8123?query=SELECT+1" --data ''
|
||||
|
Loading…
Reference in New Issue
Block a user