This commit is contained in:
proller 2016-11-16 03:34:57 +03:00
parent d56fc2fd39
commit 099edebc28
3 changed files with 5 additions and 4 deletions

View File

@ -44,6 +44,7 @@ private:
const std::string host;
int port;
const std::string path;
const std::string method;
const std::string format;
Block sample_block;

View File

@ -19,10 +19,10 @@ namespace DB
class ReadBufferFromHTTP : public ReadBuffer
{
private:
String method;
String host;
int port;
String path;
String method;
Poco::Net::HTTPClientSession session;
std::istream * istr; /// owned by session

View File

@ -3,8 +3,7 @@
#include <DB/Interpreters/Context.h>
#include <DB/Dictionaries/OwningBufferBlockInputStream.h>
#include <DB/IO/ReadBufferFromHTTP.h>
#include <DB/IO/RemoteReadBuffer.h>
#include <Poco/Net/HTTPRequest.h>
//#include <Poco/Net/HTTPRequest.h> // HTTP_GET
namespace DB
{
@ -16,6 +15,7 @@ HTTPDictionarySource::HTTPDictionarySource(const Poco::Util::AbstractConfigurati
host{config.getString(config_prefix + ".host")},
port{std::stoi(config.getString(config_prefix + ".port"))},
path{config.getString(config_prefix + ".path")},
method{config.getString(config_prefix + ".method")},
format{config.getString(config_prefix + ".format")},
sample_block{sample_block},
context(context)
@ -36,7 +36,7 @@ HTTPDictionarySource::HTTPDictionarySource(const HTTPDictionarySource & other) :
BlockInputStreamPtr HTTPDictionarySource::loadAll()
{
auto in_ptr = std::make_unique<ReadBufferFromHTTP>(host, port, path, params, Poco::Net::HTTPRequest::HTTP_GET);
auto in_ptr = std::make_unique<ReadBufferFromHTTP>(host, port, path, ReadBufferFromHTTP::Params(), method);
auto stream = context.getInputFormat( format, *in_ptr, sample_block, max_block_size);
return std::make_shared<OwningBufferBlockInputStream>(stream, std::move(in_ptr));
}