Skip to content

Commit e82051e

Browse files
committed
Explicitly add a "Connection: close" header to the request in the example.
1 parent febd74e commit e82051e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

contrib/http_examples/http/hello_world_client.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,16 @@ int main(int argc, char* argv[]) {
2323
return 1;
2424
}
2525

26+
/*<< Creates the client. >>*/
27+
http::client client;
28+
2629
try {
27-
/*<< Creates the client. >>*/
28-
http::client client;
2930
/*<< Creates a request using a URI supplied on the command
3031
line. >>*/
3132
http::client::request request(argv[1]);
33+
/*<< Explicitly set a Connection: close header to the
34+
request. >>*/
35+
request << network::header("Connection", "close");
3236
/*<< Gets a response from the HTTP server. >>*/
3337
http::client::response response = client.get(request);
3438
/*<< Prints the response body to the console. >>*/

0 commit comments

Comments
 (0)