Print user agent into log
This commit is contained in:
parent
82ead0a405
commit
b7bcc401e7
@ -53,6 +53,7 @@ enum CompressionType {
|
|||||||
struct Request {
|
struct Request {
|
||||||
std::string uri;
|
std::string uri;
|
||||||
std::string referrer;
|
std::string referrer;
|
||||||
|
std::string agent;
|
||||||
boost::asio::ip::address endpoint;
|
boost::asio::ip::address endpoint;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public:
|
|||||||
Tm=localtime(<ime);
|
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 << " " <<
|
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() << " " << req.referrer << " " << request );
|
req.endpoint.to_string() << " " << req.referrer << ( 0 == req.referrer.length() ? "- " :" ") << req.agent << ( 0 == req.agent.length() ? "- " :" ") << request );
|
||||||
std::string command;
|
std::string command;
|
||||||
std::size_t firstAmpPosition = request.find_first_of("?");
|
std::size_t firstAmpPosition = request.find_first_of("?");
|
||||||
command = request.substr(1,firstAmpPosition-1);
|
command = request.substr(1,firstAmpPosition-1);
|
||||||
|
@ -164,9 +164,12 @@ private:
|
|||||||
*compressionType = gzipRFC1952;
|
*compressionType = gzipRFC1952;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(header.name == "Referer")
|
if("Referer" == header.name)
|
||||||
req.referrer = header.value;
|
req.referrer = header.value;
|
||||||
|
|
||||||
|
if("User-Agent" == header.name)
|
||||||
|
req.agent = header.value;
|
||||||
|
|
||||||
if (input == '\r') {
|
if (input == '\r') {
|
||||||
state_ = expecting_newline_3;
|
state_ = expecting_newline_3;
|
||||||
return boost::indeterminate;
|
return boost::indeterminate;
|
||||||
|
Loading…
Reference in New Issue
Block a user