Fix prepare_payload: chunked is HTTP/1.1

This commit is contained in:
Vinnie Falco committed 2017-10-27 11:16:10 -07:00
1 parent b5389ba5f2
commit 597802c38a
2 files changed
+11 -8

No files matched your search

+10 -8
View File
@@ -382,7 +382,7 @@ prepare_payload(std::true_type)
this->chunked(false);
}
}
else if(this->version() >= 11)
else if(this->version() == 11)
{
this->chunked(true);
}
@@ -398,19 +398,21 @@ message<isRequest, Body, Fields>::
prepare_payload(std::false_type)
{
auto const n = payload_size();
if((status_class(this->result()) == status_class::informational ||
if( (! n || *n > 0) && (
(status_class(this->result()) == status_class::informational ||
this->result() == status::no_content ||
this->result() == status::not_modified))
this->result() == status::not_modified)))
{
if(! n || *n > 0)
// The response body MUST be empty for this case
BOOST_THROW_EXCEPTION(std::invalid_argument{
"invalid response body"});
// The response body MUST be empty for this case
BOOST_THROW_EXCEPTION(std::invalid_argument{
"invalid response body"});
}
if(n)
this->content_length(n);
else
else if(this->version() == 11)
this->chunked(true);
else
this->chunked(false);
}
//------------------------------------------------------------------------------