http write returns success on connection close (API Change):

fix #767

The write family of HTTP stream algorithms no longer returns
error::end_of_stream when the message indicates that the connection
should be closed.

Actions Required:

* Add code to servers to close the connection after successfully
  writing a message where `message::keep_alive()` would return `false`.
This commit is contained in:
Vinnie Falco
2017-10-22 07:03:04 -07:00
parent 885b9dfe0b
commit d0d4e0a740
16 changed files with 122 additions and 83 deletions
+1 -14
View File
@@ -162,12 +162,7 @@ operator()(
error_code ec, std::size_t bytes_transferred)
{
if(! ec)
{
sr_.consume(bytes_transferred);
if(sr_.is_done())
if(! sr_.keep_alive())
ec = error::end_of_stream;
}
h_(ec, bytes_transferred);
}
@@ -478,15 +473,9 @@ write_some(
return f.bytes_transferred;
if(f.invoked)
sr.consume(f.bytes_transferred);
if(sr.is_done())
if(! sr.keep_alive())
ec = error::end_of_stream;
return f.bytes_transferred;
}
if(! sr.keep_alive())
ec = error::end_of_stream;
else
ec.assign(0, ec.category());
ec.assign(0, ec.category());
return 0;
}
@@ -909,8 +898,6 @@ operator<<(std::ostream& os,
sr.next(ec, f);
if(os.fail())
break;
if(ec == error::end_of_stream)
ec.assign(0, ec.category());
if(ec)
{
os.setstate(std::ios::failbit);