diff --git a/server_http.hpp b/server_http.hpp index ea75582..1c3ba05 100644 --- a/server_http.hpp +++ b/server_http.hpp @@ -84,11 +84,6 @@ namespace SimpleWeb { Request(): content(streambuf) {} boost::asio::streambuf streambuf; - - void read_remote_endpoint_data(socket_type& socket) { - remote_endpoint_address=socket.lowest_layer().remote_endpoint().address().to_string(); - remote_endpoint_port=socket.lowest_layer().remote_endpoint().port(); - } }; class Config { @@ -112,6 +107,8 @@ namespace SimpleWeb { std::unordered_map::Response>, std::shared_ptr::Request>)> > default_resource; + + std::function exception_handler; private: std::vector exception_handler; protected: boost::asio::io_service io_service; @@ -217,7 +213,8 @@ namespace SimpleWeb { //shared_ptr is used to pass temporary objects to the asynchronous functions std::shared_ptr request(new Request()); try { - request->read_remote_endpoint_data(*socket); + request->remote_endpoint_address=socket->lowest_layer().remote_endpoint().address().to_string(); + request->remote_endpoint_port=socket->lowest_layer().remote_endpoint().port(); } catch(const std::exception &e) { if(exception_handler)