Client's chunked transfer: no longer moves empty streambuf

This commit is contained in:
eidheim 2017-09-27 13:34:22 +02:00
commit efac6cd8c4

View file

@ -594,8 +594,10 @@ namespace SimpleWeb {
if(length > 0)
this->read_chunked(session, tmp_streambuf);
else {
std::ostream response_stream(&session->response->streambuf);
response_stream << tmp_streambuf.get();
if(tmp_streambuf->size() > 0) {
std::ostream response_stream(&session->response->streambuf);
response_stream << tmp_streambuf.get();
}
error_code ec;
session->callback(session->connection, ec);
}