/info now displays remote host and port

This commit is contained in:
Christophe Meessen 2015-06-15 10:41:01 +02:00 committed by eidheim
commit 247639b1e0
2 changed files with 4 additions and 4 deletions

View file

@ -57,7 +57,7 @@ int main() {
//Responds with request-information
server.resource["^/info$"]["GET"]=[](HttpServer::Response& response, shared_ptr<HttpServer::Request> request) {
stringstream content_stream;
content_stream << "<h1>Request:</h1>";
content_stream << "<h1>Request from " << request->endpoint.address().to_string() << " (" << request->endpoint.port() << ")</h1>";
content_stream << request->method << " " << request->path << " HTTP/" << request->http_version << "<br>";
for(auto& header: request->header) {
content_stream << header.first << ": " << header.second << "<br>";
@ -155,4 +155,4 @@ int main() {
server_thread.join();
return 0;
}
}