Fixes #283 : Added Server::Request::remote_endpoint()

This commit is contained in:
eidheim 2019-09-15 18:46:51 +02:00
commit fa38408853

View file

@ -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())