diff --git a/CMakeLists.txt b/CMakeLists.txt index 91bc3e77e..dff34cb90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,12 +4,17 @@ # http://www.boost.org/LICENSE_1_0.txt) cmake_minimum_required(VERSION 2.8) -project(CPP-NETLIB) +cmake_policy(SET CMP0048 NEW) # The project() command manages VERSION variables. +project(CPP-NETLIB VERSION 0.11.1) -option( CPP-NETLIB_BUILD_SHARED_LIBS "Build cpp-netlib as shared libraries." OFF ) -option( CPP-NETLIB_BUILD_TESTS "Build the cpp-netlib project tests." ON) -option( CPP-NETLIB_BUILD_EXPERIMENTS "Build the cpp-netlib project experiments." ON) -option( CPP-NETLIB_BUILD_EXAMPLES "Build the cpp-netlib project examples." ON) +if(MSVC) + option( CPP-NETLIB_BUILD_SHARED_LIBS "Build cpp-netlib as shared libraries." OFF) +else() + option( CPP-NETLIB_BUILD_SHARED_LIBS "Build cpp-netlib as shared libraries." ON) +endif() +option( CPP-NETLIB_BUILD_TESTS "Build the cpp-netlib project tests." OFF) +option( CPP-NETLIB_BUILD_EXPERIMENTS "Build the cpp-netlib project experiments." OFF) +option( CPP-NETLIB_BUILD_EXAMPLES "Build the cpp-netlib project examples." OFF) option( CPP-NETLIB_ENABLE_HTTPS "Build cpp-netlib with support for https if OpenSSL is found." ON) include(GNUInstallDirs) @@ -87,7 +92,7 @@ if (Boost_FOUND) if (WIN32) add_definitions(-D_WIN32_WINNT=0x0501) endif(WIN32) - include_directories(${Boost_INCLUDE_DIRS}) + include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) enable_testing() add_subdirectory(libs/network/src) if (CPP-NETLIB_BUILD_TESTS) diff --git a/boost/network/protocol/http/server/socket_options_base.hpp b/boost/network/protocol/http/server/socket_options_base.hpp index 9cc2ee156..7087798f8 100644 --- a/boost/network/protocol/http/server/socket_options_base.hpp +++ b/boost/network/protocol/http/server/socket_options_base.hpp @@ -33,7 +33,7 @@ struct socket_options_base { receive_low_watermark(options.receive_low_watermark()), send_low_watermark(options.send_low_watermark()), non_blocking_io(options.non_blocking_io()), - linger(options.linger(), options.linger_timeout()) {} + linger(options.linger(), int(options.linger_timeout())) {} void acceptor_options(boost::asio::ip::tcp::acceptor &acceptor) { acceptor.set_option(acceptor_reuse_address); diff --git a/boost/network/protocol/http/server/sync_server.hpp b/boost/network/protocol/http/server/sync_server.hpp index 7c5c42fab..1c021f7b1 100644 --- a/boost/network/protocol/http/server/sync_server.hpp +++ b/boost/network/protocol/http/server/sync_server.hpp @@ -62,6 +62,9 @@ struct sync_server_base : server_storage_base, socket_options_base { if (!listening_) start_listening(); } + const string_type& address() const { return address_; } + const string_type& port() const { return port_; } + private: Handler& handler_; string_type address_, port_; @@ -86,7 +89,7 @@ struct sync_server_base : server_storage_base, socket_options_base { using boost::asio::ip::tcp; system::error_code error; tcp::resolver resolver(service_); - tcp::resolver::query query(address_, port_); + tcp::resolver::query query(tcp::v4(), address_, port_); tcp::resolver::iterator endpoint_iterator = resolver.resolve(query, error); if (error) { BOOST_NETWORK_MESSAGE("Error resolving address: " << address_ << ':' @@ -109,6 +112,8 @@ struct sync_server_base : server_storage_base, socket_options_base { << error << '\''); boost::throw_exception(std::runtime_error("Error binding to socket.")); } + address_ = acceptor_.local_endpoint().address().to_v4().to_string(); + port_ = std::to_string(acceptor_.local_endpoint().port()); acceptor_.listen(tcp::socket::max_connections, error); if (error) { BOOST_NETWORK_MESSAGE("Error listening on socket: "
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: