Fixes #283 : Added Server::Request::remote_endpoint()
This commit is contained in:
parent
b914172056
commit
fa38408853
1 changed files with 10 additions and 0 deletions
|
|
@ -244,6 +244,16 @@ namespace SimpleWeb {
|
||||||
/// The time point when the request header was fully read.
|
/// The time point when the request header was fully read.
|
||||||
std::chrono::system_clock::time_point header_read_time;
|
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 {
|
std::string remote_endpoint_address() const noexcept {
|
||||||
try {
|
try {
|
||||||
if(auto connection = this->connection.lock())
|
if(auto connection = this->connection.lock())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue