diff --git a/Server/BasicDatastructures.h b/Server/BasicDatastructures.h index 6dd0c97d3..a788921ce 100644 --- a/Server/BasicDatastructures.h +++ b/Server/BasicDatastructures.h @@ -52,6 +52,7 @@ enum CompressionType { struct Request { std::string uri; + std::string referrer; boost::asio::ip::address endpoint; }; diff --git a/Server/RequestHandler.h b/Server/RequestHandler.h index 95ffa8585..081f4260c 100644 --- a/Server/RequestHandler.h +++ b/Server/RequestHandler.h @@ -58,7 +58,7 @@ public: Tm=localtime(<ime); INFO((Tm->tm_mday < 10 ? "0" : "" ) << Tm->tm_mday << "-" << (Tm->tm_mon < 10 ? "0" : "" ) << Tm->tm_mon << "-" << 1900+Tm->tm_year << " " << (Tm->tm_hour < 10 ? "0" : "" ) << Tm->tm_hour << ":" << (Tm->tm_min < 10 ? "0" : "" ) << Tm->tm_min << ":" << (Tm->tm_sec < 10 ? "0" : "" ) << Tm->tm_sec << " " << - req.endpoint.to_string() << " " << request ); + req.endpoint.to_string() << " " << req.referrer << " " << request ); std::string command; std::size_t firstAmpPosition = request.find_first_of("?"); command = request.substr(1,firstAmpPosition-1); diff --git a/Server/RequestParser.h b/Server/RequestParser.h index e26a414c9..c501eb2e2 100644 --- a/Server/RequestParser.h +++ b/Server/RequestParser.h @@ -164,6 +164,9 @@ private: *compressionType = gzipRFC1952; } + if(header.name == "Referer") + req.referrer = header.value; + if (input == '\r') { state_ = expecting_newline_3; return boost::indeterminate;