Commit 556212a6 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Replace \r\n in the header field to SPC in http downstream

parent 091f38a9
......@@ -122,6 +122,15 @@ void capitalize(std::string& s, size_t offset)
}
}
void sanitize_header_value(std::string& s, size_t offset)
{
for(size_t i = offset, eoi = s.size(); i < eoi; ++i) {
if(s[i] == '\r' || s[i] == '\n') {
s[i] = ' ';
}
}
}
std::string colorizeHeaders(const char *hdrs)
{
std::string nhdrs;
......
......@@ -41,6 +41,8 @@ std::string create_via_header_value(int major, int minor);
void capitalize(std::string& s, size_t offset);
void sanitize_header_value(std::string& s, size_t offset);
// Adds ANSI color codes to HTTP headers |hdrs|.
std::string colorizeHeaders(const char *hdrs);
......
......@@ -160,6 +160,7 @@ int HttpDownstreamConnection::push_request_headers()
http::capitalize(hdrs, hdrs.size()-(*i).first.size());
hdrs += ": ";
hdrs += (*i).second;
http::sanitize_header_value(hdrs, hdrs.size()-(*i).second.size());
hdrs += "\r\n";
}
if(downstream_->get_request_connection_close()) {
......
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