https_get example sends the Host header:

close #1751

If you try the https_get example with the Server header, servers will
respond with 400 Bad Request. This example works as it should when it
uses the Host header.
This commit is contained in:
Roel Standaert
2019-10-31 18:22:19 +01:00
committed by Vinnie Falco
parent bb85859e96
commit dcc30bcc40
2 changed files with 2 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ Version 275:
* Add basic_stream::rebind_executor
* Use automatically deduced return types for all async operations
* Support Concepts for completion token params
* https_get example sends the Host header
--------------------------------------------------------------------------------

View File

@@ -356,7 +356,7 @@ https_get (std::string const& host, std::string const& target, error_code& ec)
req.method(http::verb::get);
req.target(target);
req.version(11);
req.set(http::field::server, host);
req.set(http::field::host, host);
req.set(http::field::user_agent, "Beast");
http::async_write(stream, req, yield[ec]);
if(ec)