#pragma once #include #include #include #include #include #include #define DEFAULT_HTTP_READ_BUFFER_TIMEOUT 1800 #define DEFAULT_HTTP_READ_BUFFER_CONNECTION_TIMEOUT 1 namespace DB { /** Perform HTTP POST request and provide response to read. */ class ReadWriteBufferFromHTTP : public ReadBuffer { private: Poco::URI uri; std::string method; std::unique_ptr session; std::istream * istr; /// owned by session std::unique_ptr impl; public: using OutStreamCallback = std::function; explicit ReadWriteBufferFromHTTP( Poco::URI uri, const std::string & method = {}, OutStreamCallback out_stream_callback = {}, const ConnectionTimeouts & timeouts = {}, const Poco::Net::HTTPBasicCredentials & credentials = {}, size_t buffer_size_ = DBMS_DEFAULT_BUFFER_SIZE); bool nextImpl() override; }; }