From 09975ce12bd61572fa99fad1faa19783085f3158 Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Fri, 8 Apr 2016 14:18:42 -0400 Subject: [PATCH] adding IP address to http request handler --- include/fc/network/http/connection.hpp | 5 +++-- src/network/http/http_connection.cpp | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/fc/network/http/connection.hpp b/include/fc/network/http/connection.hpp index 3c8de77..786f24d 100644 --- a/include/fc/network/http/connection.hpp +++ b/include/fc/network/http/connection.hpp @@ -40,11 +40,12 @@ namespace fc { struct request { fc::string get_header( const fc::string& key )const; + fc::string remote_endpoint; fc::string method; fc::string domain; fc::string path; - std::vector
headers; - std::vector body; + std::vector
headers; + std::vector body; }; std::vector
parse_urlencoded_params( const fc::string& f ); diff --git a/src/network/http/http_connection.cpp b/src/network/http/http_connection.cpp index 309866d..59fb39b 100644 --- a/src/network/http/http_connection.cpp +++ b/src/network/http/http_connection.cpp @@ -134,6 +134,7 @@ fc::tcp_socket& connection::get_socket()const { http::request connection::read_request()const { http::request req; + req.remote_endpoint = fc::variant(get_socket().remote_endpoint()).as_string(); std::vector line(1024*8); int s = my->read_until( line.data(), line.data()+line.size(), ' ' ); // METHOD req.method = line.data();