Commit 4ac68952 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

Don't modify user-agent

parent ac84b681
...@@ -203,24 +203,18 @@ int Downstream::push_request_headers() ...@@ -203,24 +203,18 @@ int Downstream::push_request_headers()
hdrs += "Host: "; hdrs += "Host: ";
hdrs += get_config()->downstream_hostport; hdrs += get_config()->downstream_hostport;
hdrs += "\r\n"; hdrs += "\r\n";
// TODO Rewrite user-agent?
for(Headers::const_iterator i = request_headers_.begin(); for(Headers::const_iterator i = request_headers_.begin();
i != request_headers_.end(); ++i) { i != request_headers_.end(); ++i) {
if(util::strieq((*i).first.c_str(), "X-Forwarded-Proto")) { if(util::strieq((*i).first.c_str(), "X-Forwarded-Proto")) {
continue; continue;
} }
if(util::strieq((*i).first.c_str(), "user-agent")) { hdrs += (*i).first;
hdrs += "User-Agent: "; hdrs += ": ";
hdrs += get_config()->server_name; hdrs += (*i).second;
} else { if(!xff_found && util::strieq((*i).first.c_str(), "X-Forwarded-For")) {
hdrs += (*i).first; xff_found = true;
hdrs += ": "; hdrs += ", ";
hdrs += (*i).second; hdrs += upstream_->get_client_handler()->get_ipaddr();
if(!xff_found && util::strieq((*i).first.c_str(), "X-Forwarded-For")) {
xff_found = true;
hdrs += ", ";
hdrs += upstream_->get_client_handler()->get_ipaddr();
}
} }
hdrs += "\r\n"; hdrs += "\r\n";
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment