Remove explicit limit on HTTP chunk size.
This commit is contained in:
parent
0a3fa80e40
commit
0761329c61
@ -19,7 +19,7 @@ bool HttpChunkedByteFlow::loop() {
|
||||
do {
|
||||
if (state_ == State::ReadChunkLength) {
|
||||
bool ok = find_boundary(input_->clone(), "\r\n", len_);
|
||||
if (len_ > 10) {
|
||||
if (len_ > 8) {
|
||||
finish(Status::Error(PSLICE() << "Too long length in chunked "
|
||||
<< input_->cut_head(len_).move_as_buffer_slice().as_slice()));
|
||||
return false;
|
||||
@ -31,17 +31,13 @@ bool HttpChunkedByteFlow::loop() {
|
||||
auto s_len = input_->cut_head(len_).move_as_buffer_slice();
|
||||
input_->advance(2);
|
||||
len_ = hex_to_integer<size_t>(s_len.as_slice());
|
||||
if (len_ > MAX_CHUNK_SIZE) {
|
||||
finish(Status::Error(PSLICE() << "Invalid chunk size " << tag("size", len_)));
|
||||
return false;
|
||||
}
|
||||
save_len_ = len_;
|
||||
state_ = State::ReadChunkContent;
|
||||
}
|
||||
|
||||
auto size = input_->size();
|
||||
auto ready = min(len_, size);
|
||||
auto need_size = min(MIN_UPDATE_SIZE, len_ + 2);
|
||||
auto need_size = min(MIN_UPDATE_SIZE, len_) + 2;
|
||||
if (size < need_size) {
|
||||
set_need_size(need_size);
|
||||
break;
|
||||
|
@ -17,7 +17,6 @@ class HttpChunkedByteFlow final : public ByteFlowBase {
|
||||
bool loop() final;
|
||||
|
||||
private:
|
||||
static constexpr size_t MAX_CHUNK_SIZE = 15 << 20; // some reasonable limit
|
||||
static constexpr size_t MAX_SIZE = std::numeric_limits<uint32>::max(); // some reasonable limit
|
||||
static constexpr size_t MIN_UPDATE_SIZE = 1 << 14;
|
||||
enum class State { ReadChunkLength, ReadChunkContent, OK };
|
||||
|
Loading…
Reference in New Issue
Block a user