Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit64de3c9

Browse files
committed
Fixed error in documentation, and updated hello_world_server example.
1 parent8f7d470 commit64de3c9

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

‎boost/network/protocol/http/client/connection/sync_normal.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ struct http_sync_connection
7777
}
7878
}
7979
if (timeout_ >0) {
80-
timer_.expires_from_now(boost::posix_time::seconds(timeout_));
80+
timer_.expires_from_now(std::chrono::seconds(timeout_));
8181
auto self =this->shared_from_this();
8282
timer_.async_wait([=] (boost::system::error_codeconst &ec) {
8383
self->handle_timeout(ec);

‎boost/network/protocol/http/client/connection/sync_ssl.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ struct https_sync_connection
119119
}
120120
}
121121
if (timeout_ >0) {
122-
timer_.expires_from_now(boost::posix_time::seconds(timeout_));
122+
timer_.expires_from_now(std::chrono::seconds(timeout_));
123123
auto self =this->shared_from_this();
124124
timer_.async_wait(
125125
[=](boost::system::error_codeconst& ec) { self->handle_timeout(ec); });

‎libs/network/doc/examples/http/hello_world_server.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ simple response to any HTTP request.
3232
unsigned int port = request.source_port;
3333
std::ostringstream data;
3434
data << "Hello, " << ip << ':' << port << '!';
35+
connection->set_status(server::connection::ok);
3536
connection->write(data.str());
3637
}
3738
};
@@ -140,4 +141,3 @@ The ``options`` constructor's single argument is the handler object defined prev
140141
resources across threads. The handler is passed by reference to the server
141142
constructor and you should ensure that any calls to the ``operator()`` overload
142143
are thread-safe.
143-

‎libs/network/example/http/hello_world_server.cpp‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ struct hello_world {
2929
unsignedint port = request.source_port;
3030
std::ostringstream data;
3131
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);
3239
connection->write(data.str());
3340
}
3441
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp