File tree Expand file tree Collapse file tree 4 files changed +10
-3
lines changed
boost/network/protocol/http/client/connection Expand file tree Collapse file tree 4 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ struct http_sync_connection
77
77
}
78
78
}
79
79
if (timeout_ > 0 ) {
80
- timer_.expires_from_now (boost::posix_time ::seconds (timeout_));
80
+ timer_.expires_from_now (std::chrono ::seconds (timeout_));
81
81
auto self = this ->shared_from_this ();
82
82
timer_.async_wait ([=] (boost::system::error_code const &ec) {
83
83
self->handle_timeout (ec);
Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ struct https_sync_connection
119
119
}
120
120
}
121
121
if (timeout_ > 0 ) {
122
- timer_.expires_from_now (boost::posix_time ::seconds (timeout_));
122
+ timer_.expires_from_now (std::chrono ::seconds (timeout_));
123
123
auto self = this ->shared_from_this ();
124
124
timer_.async_wait (
125
125
[=](boost::system::error_code const & ec) { self->handle_timeout (ec); });
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ simple response to any HTTP request.
32
32
unsigned int port = request.source_port;
33
33
std::ostringstream data;
34
34
data << "Hello, " << ip << ':' << port << '!';
35
+ connection->set_status(server::connection: :ok);
35
36
connection->write(data.str());
36
37
}
37
38
};
@@ -140,4 +141,3 @@ The ``options`` constructor's single argument is the handler object defined prev
140
141
resources across threads. The handler is passed by reference to the server
141
142
constructor and you should ensure that any calls to the ``operator() `` overload
142
143
are thread-safe.
143
-
Original file line number Diff line number Diff line change @@ -29,6 +29,13 @@ struct hello_world {
29
29
unsigned int port = request.source_port ;
30
30
std::ostringstream data;
31
31
data << " Hello, " << ip << ' :' << port << ' !' ;
32
+
33
+ std::map<std::string, std::string> headers = {
34
+ {" Content-Type" , " text/plain" },
35
+ };
36
+
37
+ connection->set_status (server::connection::ok);
38
+ connection->set_headers (headers);
32
39
connection->write (data.str ());
33
40
}
34
41
};
You can’t perform that action at this time.
0 commit comments