Fix for basic_parser::skip(true) and docs

fix #742
This commit is contained in:
Vinnie Falco
2017-08-15 06:58:33 -07:00
parent f570593a01
commit 76feb4afd4
6 changed files with 25 additions and 12 deletions

View File

@@ -411,11 +411,18 @@ do_head_request(
return {};
// Create a parser to read the response.
// Responses to HEAD requests MUST NOT include
// a body, so we use the `empty_body` type and
// only attempt to read the header.
parser<false, empty_body> p;
read_header(stream, buffer, p, ec);
// We use the `empty_body` type since
// a response to a HEAD request MUST NOT
// include a body.
response_parser<empty_body> p;
// Inform the parser that there will be no body.
p.skip(true);
// Read the message. Even though fields like
// Content-Length or Transfer-Encoding may be
// set, the message will not contain a body.
read(stream, buffer, p, ec);
if(ec)
return {};