mirror of
https://github.com/boostorg/beast.git
synced 2025-07-30 12:57: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
|
Version 40
|
||||||
|
|
||||||
* Add to_static_string
|
* Add to_static_string
|
||||||
|
@ -185,8 +185,11 @@ operator()(error_code ec,
|
|||||||
BOOST_ASSERT(bytes_transferred == 0);
|
BOOST_ASSERT(bytes_transferred == 0);
|
||||||
d.bytes_used = 0;
|
d.bytes_used = 0;
|
||||||
if(! d.p.got_some())
|
if(! d.p.got_some())
|
||||||
|
{
|
||||||
|
ec = error::end_of_stream;
|
||||||
goto upcall;
|
goto upcall;
|
||||||
// caller sees EOF on next read.
|
}
|
||||||
|
// caller sees end_of_stream on next read.
|
||||||
ec = {};
|
ec = {};
|
||||||
d.p.write_eof(ec);
|
d.p.write_eof(ec);
|
||||||
if(ec)
|
if(ec)
|
||||||
@ -194,7 +197,7 @@ operator()(error_code ec,
|
|||||||
BOOST_ASSERT(d.p.is_complete());
|
BOOST_ASSERT(d.p.is_complete());
|
||||||
goto upcall;
|
goto upcall;
|
||||||
}
|
}
|
||||||
else if(ec)
|
if(ec)
|
||||||
{
|
{
|
||||||
d.bytes_used = 0;
|
d.bytes_used = 0;
|
||||||
goto upcall;
|
goto upcall;
|
||||||
|
@ -76,7 +76,9 @@ read_some_buffer(
|
|||||||
if(ec)
|
if(ec)
|
||||||
return 0;
|
return 0;
|
||||||
BOOST_ASSERT(parser.is_complete());
|
BOOST_ASSERT(parser.is_complete());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
ec = error::end_of_stream;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(ec)
|
else if(ec)
|
||||||
|
@ -41,6 +41,11 @@ namespace http {
|
|||||||
being parsed. This additional data is stored in the dynamic
|
being parsed. This additional data is stored in the dynamic
|
||||||
buffer, which may be used in subsequent calls.
|
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.
|
@param stream The stream from which the data is to be read.
|
||||||
The type must support the @b SyncReadStream concept.
|
The type must support the @b SyncReadStream concept.
|
||||||
|
|
||||||
@ -92,6 +97,11 @@ read_some(
|
|||||||
being parsed. This additional data is stored in the dynamic
|
being parsed. This additional data is stored in the dynamic
|
||||||
buffer, which may be used in subsequent calls.
|
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.
|
@param stream The stream from which the data is to be read.
|
||||||
The type must support the @b SyncReadStream concept.
|
The type must support the @b SyncReadStream concept.
|
||||||
|
|
||||||
@ -151,6 +161,11 @@ read_some(
|
|||||||
processed from the dynamic buffer. The caller should remove
|
processed from the dynamic buffer. The caller should remove
|
||||||
these bytes by calling `consume` on the dynamic buffer.
|
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.
|
@param stream The stream from which the data is to be read.
|
||||||
The type must support the @b AsyncReadStream concept.
|
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
|
being parsed. This additional data is stored in the dynamic
|
||||||
buffer, which may be used in subsequent calls.
|
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.
|
@param stream The stream from which the data is to be read.
|
||||||
The type must support the @b SyncReadStream concept.
|
The type must support the @b SyncReadStream concept.
|
||||||
|
|
||||||
@ -244,6 +264,11 @@ read(
|
|||||||
being parsed. This additional data is stored in the dynamic
|
being parsed. This additional data is stored in the dynamic
|
||||||
buffer, which may be used in subsequent calls.
|
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.
|
@param stream The stream from which the data is to be read.
|
||||||
The type must support the @b SyncReadStream concept.
|
The type must support the @b SyncReadStream concept.
|
||||||
|
|
||||||
@ -287,6 +312,11 @@ read(
|
|||||||
end of the object being parsed. This additional data is stored
|
end of the object being parsed. This additional data is stored
|
||||||
in the stream buffer, which may be used in subsequent calls.
|
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.
|
@param stream The stream from which the data is to be read.
|
||||||
The type must support the @b AsyncReadStream concept.
|
The type must support the @b AsyncReadStream concept.
|
||||||
|
|
||||||
@ -338,6 +368,11 @@ async_read(
|
|||||||
being parsed. This additional data is stored in the dynamic
|
being parsed. This additional data is stored in the dynamic
|
||||||
buffer, which may be used in subsequent calls.
|
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.
|
@param stream The stream from which the data is to be read.
|
||||||
The type must support the @b `SyncReadStream` concept.
|
The type must support the @b `SyncReadStream` concept.
|
||||||
|
|
||||||
@ -379,6 +414,11 @@ read(
|
|||||||
being parsed. This additional data is stored in the dynamic
|
being parsed. This additional data is stored in the dynamic
|
||||||
buffer, which may be used in subsequent calls.
|
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.
|
@param stream The stream from which the data is to be read.
|
||||||
The type must support the @b `SyncReadStream` concept.
|
The type must support the @b `SyncReadStream` concept.
|
||||||
|
|
||||||
@ -424,6 +464,11 @@ read(
|
|||||||
end of the message being parsed. This additional data is stored
|
end of the message being parsed. This additional data is stored
|
||||||
in the dynamic buffer, which may be used in subsequent calls.
|
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.
|
@param stream The stream to read the message from.
|
||||||
The type must support the @b `AsyncReadStream` concept.
|
The type must support the @b `AsyncReadStream` concept.
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ public:
|
|||||||
message_parser<true, dynamic_body, fields> p;
|
message_parser<true, dynamic_body, fields> p;
|
||||||
error_code ec;
|
error_code ec;
|
||||||
read(ss, b, p, ec);
|
read(ss, b, p, ec);
|
||||||
BEAST_EXPECT(ec == boost::asio::error::eof);
|
BEAST_EXPECT(ec == http::error::end_of_stream);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
multi_buffer b;
|
multi_buffer b;
|
||||||
@ -261,7 +261,7 @@ public:
|
|||||||
message_parser<true, dynamic_body, fields> p;
|
message_parser<true, dynamic_body, fields> p;
|
||||||
error_code ec;
|
error_code ec;
|
||||||
async_read(ss, b, p, do_yield[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