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

Provide source port as part of the request#196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
deanberris merged 1 commit intocpp-netlib:0.9-develfromCovenantEyes:ce-custom
Jan 25, 2013
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Re-provide source port as part of the request
  • Loading branch information
@3noch
3noch committedJan 24, 2013
commit1ff1a1ba6e718df9fa028372c72a758ae87f0a58
2 changes: 2 additions & 0 deletionsboost/network/protocol/http/impl/request.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -157,6 +157,7 @@ namespace http {
typedef vector_type headers_container_type;
typedef boost::uint16_t port_type;
mutable string_type source;
mutable port_type source_port;
mutable string_type method;
mutable string_type destination;
mutable boost::uint8_t http_version_major;
Expand All@@ -168,6 +169,7 @@ namespace http {
using std::swap;
swap(method, r.method);
swap(source, r.source);
swap(source_port, r.source_port);
swap(destination, r.destination);
swap(http_version_major, r.http_version_major);
swap(http_version_minor, r.http_version_minor);
Expand Down
1 change: 1 addition & 0 deletionsboost/network/protocol/http/server/sync_connection.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -79,6 +79,7 @@ namespace boost { namespace network { namespace http {
voidhandle_read_headers(boost::system::error_codeconst &ec,size_t bytes_transferred) {
if (!ec) {
request_.source = socket_.remote_endpoint().address().to_string();
request_.source_port = socket_.remote_endpoint().port();
boost::tribool done;
buffer_type::iterator new_start;
tie(done,new_start) = parser_.parse_headers(request_, buffer_.data(), buffer_.data() + bytes_transferred);
Expand Down
3 changes: 2 additions & 1 deletionlibs/network/example/http/hello_world_server.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,8 +29,9 @@ struct hello_world {
voidoperator() (server::requestconst &request,
server::response &response) {
server::string_type ip =source(request);
unsignedint port = request.source_port;
std::ostringstream data;
data <<"Hello," << ip <<"!";
data <<"Hello," << ip <<':' << port <<'!';
response =server::response::stock_reply(
server::response::ok, data.str());
}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp