mirror of
https://github.com/boostorg/beast.git
synced 2025-07-29 20:37:31 +02:00
Return http::error::end_of_stream on HTTP read eof (API Change)
fix #350
This commit is contained in:
@ -1,3 +1,11 @@
|
||||
Version 41
|
||||
|
||||
API Changes
|
||||
|
||||
* Return http::error::end_of_stream on HTTP read eof
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 40
|
||||
|
||||
* Add to_static_string
|
||||
|
@ -185,8 +185,11 @@ operator()(error_code ec,
|
||||
BOOST_ASSERT(bytes_transferred == 0);
|
||||
d.bytes_used = 0;
|
||||
if(! d.p.got_some())
|
||||
{
|
||||
ec = error::end_of_stream;
|
||||
goto upcall;
|
||||
// caller sees EOF on next read.
|
||||
}
|
||||
// caller sees end_of_stream on next read.
|
||||
ec = {};
|
||||
d.p.write_eof(ec);
|
||||
if(ec)
|
||||
@ -194,7 +197,7 @@ operator()(error_code ec,
|
||||
BOOST_ASSERT(d.p.is_complete());
|
||||
goto upcall;
|
||||
}
|
||||
else if(ec)
|
||||
if(ec)
|
||||
{
|
||||
d.bytes_used = 0;
|
||||
goto upcall;
|
||||
|
@ -76,7 +76,9 @@ read_some_buffer(
|
||||
if(ec)
|
||||
return 0;
|
||||
BOOST_ASSERT(parser.is_complete());
|
||||
break;
|
||||
}
|
||||
ec = error::end_of_stream;
|
||||
break;
|
||||
}
|
||||
else if(ec)
|
||||
|
@ -41,6 +41,11 @@ namespace http {
|
||||
being parsed. This additional data is stored in the dynamic
|
||||
buffer, which may be used in subsequent calls.
|
||||
|
||||
If the end of the stream is reached during the read, the
|
||||
value @ref error::partial_message is indicated as the
|
||||
error if bytes have been processed, else the error
|
||||
@ref error::end_of_stream is indicated.
|
||||
|
||||
@param stream The stream from which the data is to be read.
|
||||
The type must support the @b SyncReadStream concept.
|
||||
|
||||
@ -92,6 +97,11 @@ read_some(
|
||||
being parsed. This additional data is stored in the dynamic
|
||||
buffer, which may be used in subsequent calls.
|
||||
|
||||
If the end of the stream is reached during the read, the
|
||||
value @ref error::partial_message is indicated as the
|
||||
error if bytes have been processed, else the error
|
||||
@ref error::end_of_stream is indicated.
|
||||
|
||||
@param stream The stream from which the data is to be read.
|
||||
The type must support the @b SyncReadStream concept.
|
||||
|
||||
@ -151,6 +161,11 @@ read_some(
|
||||
processed from the dynamic buffer. The caller should remove
|
||||
these bytes by calling `consume` on the dynamic buffer.
|
||||
|
||||
If the end of the stream is reached during the read, the
|
||||
value @ref error::partial_message is indicated as the
|
||||
error if bytes have been processed, else the error
|
||||
@ref error::end_of_stream is indicated.
|
||||
|
||||
@param stream The stream from which the data is to be read.
|
||||
The type must support the @b AsyncReadStream concept.
|
||||
|
||||
@ -205,6 +220,11 @@ async_read_some(
|
||||
being parsed. This additional data is stored in the dynamic
|
||||
buffer, which may be used in subsequent calls.
|
||||
|
||||
If the end of the stream is reached during the read, the
|
||||
value @ref error::partial_message is indicated as the
|
||||
error if bytes have been processed, else the error
|
||||
@ref error::end_of_stream is indicated.
|
||||
|
||||
@param stream The stream from which the data is to be read.
|
||||
The type must support the @b SyncReadStream concept.
|
||||
|
||||
@ -244,6 +264,11 @@ read(
|
||||
being parsed. This additional data is stored in the dynamic
|
||||
buffer, which may be used in subsequent calls.
|
||||
|
||||
If the end of the stream is reached during the read, the
|
||||
value @ref error::partial_message is indicated as the
|
||||
error if bytes have been processed, else the error
|
||||
@ref error::end_of_stream is indicated.
|
||||
|
||||
@param stream The stream from which the data is to be read.
|
||||
The type must support the @b SyncReadStream concept.
|
||||
|
||||
@ -287,6 +312,11 @@ read(
|
||||
end of the object being parsed. This additional data is stored
|
||||
in the stream buffer, which may be used in subsequent calls.
|
||||
|
||||
If the end of the stream is reached during the read, the
|
||||
value @ref error::partial_message is indicated as the
|
||||
error if bytes have been processed, else the error
|
||||
@ref error::end_of_stream is indicated.
|
||||
|
||||
@param stream The stream from which the data is to be read.
|
||||
The type must support the @b AsyncReadStream concept.
|
||||
|
||||
@ -338,6 +368,11 @@ async_read(
|
||||
being parsed. This additional data is stored in the dynamic
|
||||
buffer, which may be used in subsequent calls.
|
||||
|
||||
If the end of the stream is reached during the read, the
|
||||
value @ref error::partial_message is indicated as the
|
||||
error if bytes have been processed, else the error
|
||||
@ref error::end_of_stream is indicated.
|
||||
|
||||
@param stream The stream from which the data is to be read.
|
||||
The type must support the @b `SyncReadStream` concept.
|
||||
|
||||
@ -379,6 +414,11 @@ read(
|
||||
being parsed. This additional data is stored in the dynamic
|
||||
buffer, which may be used in subsequent calls.
|
||||
|
||||
If the end of the stream is reached during the read, the
|
||||
value @ref error::partial_message is indicated as the
|
||||
error if bytes have been processed, else the error
|
||||
@ref error::end_of_stream is indicated.
|
||||
|
||||
@param stream The stream from which the data is to be read.
|
||||
The type must support the @b `SyncReadStream` concept.
|
||||
|
||||
@ -424,6 +464,11 @@ read(
|
||||
end of the message being parsed. This additional data is stored
|
||||
in the dynamic buffer, which may be used in subsequent calls.
|
||||
|
||||
If the end of the stream is reached during the read, the
|
||||
value @ref error::partial_message is indicated as the
|
||||
error if bytes have been processed, else the error
|
||||
@ref error::end_of_stream is indicated.
|
||||
|
||||
@param stream The stream to read the message from.
|
||||
The type must support the @b `AsyncReadStream` concept.
|
||||
|
||||
|
@ -253,7 +253,7 @@ public:
|
||||
message_parser<true, dynamic_body, fields> p;
|
||||
error_code ec;
|
||||
read(ss, b, p, ec);
|
||||
BEAST_EXPECT(ec == boost::asio::error::eof);
|
||||
BEAST_EXPECT(ec == http::error::end_of_stream);
|
||||
}
|
||||
{
|
||||
multi_buffer b;
|
||||
@ -261,7 +261,7 @@ public:
|
||||
message_parser<true, dynamic_body, fields> p;
|
||||
error_code ec;
|
||||
async_read(ss, b, p, do_yield[ec]);
|
||||
BEAST_EXPECT(ec == boost::asio::error::eof);
|
||||
BEAST_EXPECT(ec == http::error::end_of_stream);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user