2021-02-19 12:51:26 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <IO/BufferWithOwnMemory.h>
|
|
|
|
#include <IO/ReadBuffer.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
/// Reads data with HTTP Chunked Transfer Encoding.
|
|
|
|
class HTTPChunkedReadBuffer : public BufferWithOwnMemory<ReadBuffer>
|
|
|
|
{
|
|
|
|
public:
|
2022-08-16 20:04:24 +00:00
|
|
|
explicit HTTPChunkedReadBuffer(std::unique_ptr<ReadBuffer> in_, size_t max_chunk_size_)
|
|
|
|
: max_chunk_size(max_chunk_size_), in(std::move(in_))
|
|
|
|
{}
|
2021-02-19 12:51:26 +00:00
|
|
|
|
|
|
|
private:
|
2022-08-16 20:04:24 +00:00
|
|
|
const size_t max_chunk_size;
|
2021-02-19 12:51:26 +00:00
|
|
|
std::unique_ptr<ReadBuffer> in;
|
|
|
|
|
|
|
|
size_t readChunkHeader();
|
|
|
|
void readChunkFooter();
|
|
|
|
|
|
|
|
bool nextImpl() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|