From fa384088531b1ac11aed8d64a00cd2464d906a6e Mon Sep 17 00:00:00 2001 From: eidheim Date: Sun, 15 Sep 2019 18:46:51 +0200 Subject: [PATCH] Fixes #283 : Added Server::Request::remote_endpoint() --- server_http.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server_http.hpp b/server_http.hpp index ab4be0e..8152383 100644 --- a/server_http.hpp +++ b/server_http.hpp @@ -244,6 +244,16 @@ namespace SimpleWeb { /// The time point when the request header was fully read. std::chrono::system_clock::time_point header_read_time; + asio::ip::tcp::endpoint remote_endpoint() const noexcept { + try { + if(auto connection = this->connection.lock()) + return connection->socket->lowest_layer().remote_endpoint(); + } + catch(...) { + } + return asio::ip::tcp::endpoint(); + } + std::string remote_endpoint_address() const noexcept { try { if(auto connection = this->connection.lock())