Skip to content

Add needed Boost libs and OpenSSL headers to CMake config #193

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 24, 2013
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Provide source port as part of the request
  • Loading branch information
3noch committed Jan 22, 2013
commit 16cf0935013e6596e889ffd22a12bf231cf1a498
2 changes: 2 additions & 0 deletions boost/network/protocol/http/impl/request.hpp
Original file line number Diff line number Diff 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 deletions boost/network/protocol/http/server/sync_connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ namespace boost { namespace network { namespace http {
void handle_read_headers(boost::system::error_code const &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 deletion libs/network/example/http/hello_world_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ struct hello_world {
void operator() (server::request const &request,
server::response &response) {
server::string_type ip = source(request);
unsigned int 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