adding IP address to http request handler
This commit is contained in:
parent
2d521c390d
commit
09975ce12b
2 changed files with 4 additions and 2 deletions
|
|
@ -40,11 +40,12 @@ namespace fc {
|
||||||
struct request
|
struct request
|
||||||
{
|
{
|
||||||
fc::string get_header( const fc::string& key )const;
|
fc::string get_header( const fc::string& key )const;
|
||||||
|
fc::string remote_endpoint;
|
||||||
fc::string method;
|
fc::string method;
|
||||||
fc::string domain;
|
fc::string domain;
|
||||||
fc::string path;
|
fc::string path;
|
||||||
std::vector<header> headers;
|
std::vector<header> headers;
|
||||||
std::vector<char> body;
|
std::vector<char> body;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<header> parse_urlencoded_params( const fc::string& f );
|
std::vector<header> parse_urlencoded_params( const fc::string& f );
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,7 @@ fc::tcp_socket& connection::get_socket()const {
|
||||||
|
|
||||||
http::request connection::read_request()const {
|
http::request connection::read_request()const {
|
||||||
http::request req;
|
http::request req;
|
||||||
|
req.remote_endpoint = fc::variant(get_socket().remote_endpoint()).as_string();
|
||||||
std::vector<char> line(1024*8);
|
std::vector<char> line(1024*8);
|
||||||
int s = my->read_until( line.data(), line.data()+line.size(), ' ' ); // METHOD
|
int s = my->read_until( line.data(), line.data()+line.size(), ' ' ); // METHOD
|
||||||
req.method = line.data();
|
req.method = line.data();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue