Skip to content

Commit df6bb4e

Browse files
committed
Revert "fix tests"
This reverts commit 884730d.
1 parent eff6616 commit df6bb4e

File tree

2 files changed

+21
-32
lines changed

2 files changed

+21
-32
lines changed

src/IO/HTTPChunkedReadBuffer.cpp

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -56,38 +56,30 @@ bool HTTPChunkedReadBuffer::nextImpl()
5656
if (!in)
5757
return false;
5858

59-
try
59+
/// The footer of previous chunk.
60+
if (count())
61+
readChunkFooter();
62+
63+
size_t chunk_size = readChunkHeader();
64+
if (0 == chunk_size)
65+
{
66+
readChunkFooter();
67+
in.reset(); // prevent double-eof situation.
68+
return false;
69+
}
70+
71+
if (in->available() >= chunk_size)
6072
{
61-
/// The footer of previous chunk.
62-
if (count())
63-
readChunkFooter();
64-
65-
size_t chunk_size = readChunkHeader();
66-
if (0 == chunk_size)
67-
{
68-
readChunkFooter();
69-
in.reset(); // prevent double-eof situation.
70-
return false;
71-
}
72-
73-
if (in->available() >= chunk_size)
74-
{
75-
/// Zero-copy read from input.
76-
working_buffer = Buffer(in->position(), in->position() + chunk_size);
77-
in->position() += chunk_size;
78-
}
79-
else
80-
{
81-
/// Chunk is not completely in buffer, copy it to scratch space.
82-
memory.resize(chunk_size);
83-
in->readStrict(memory.data(), chunk_size);
84-
working_buffer = Buffer(memory.data(), memory.data() + chunk_size);
85-
}
73+
/// Zero-copy read from input.
74+
working_buffer = Buffer(in->position(), in->position() + chunk_size);
75+
in->position() += chunk_size;
8676
}
87-
catch (...)
77+
else
8878
{
89-
in.reset();
90-
throw;
79+
/// Chunk is not completely in buffer, copy it to scratch space.
80+
memory.resize(chunk_size);
81+
in->readStrict(memory.data(), chunk_size);
82+
working_buffer = Buffer(memory.data(), memory.data() + chunk_size);
9183
}
9284

9385
/// NOTE: We postpone reading the footer to the next iteration, because it may not be completely in buffer,

src/Server/HTTP/HTTPServerRequest.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,8 @@ HTTPServerRequest::HTTPServerRequest(HTTPContextPtr context, HTTPServerResponse
7474
"and no chunked/multipart encoding, it may be impossible to distinguish graceful EOF from abnormal connection loss");
7575
}
7676
else
77-
{
7877
/// We have to distinguish empty buffer and nullptr.
7978
stream = std::make_unique<EmptyReadBuffer>();
80-
stream_is_bounded = true;
81-
}
8279
}
8380

8481
bool HTTPServerRequest::checkPeerConnected() const

0 commit comments

Comments
 (0)