Skip to content

Commit

Permalink
Strip header whitespace. Fix #1890. Code by @matthewd
Browse files Browse the repository at this point in the history
  • Loading branch information
nateberkopec committed Oct 4, 2019
1 parent 0bbb495 commit b38fbd3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ext/puma_http11/puma_http11.c
Expand Up @@ -200,6 +200,8 @@ void http_field(puma_parser* hp, const char *field, size_t flen,
f = rb_str_new(hp->buf, new_size);
}

while (vlen > 0 && isspace(value[vlen - 1])) vlen--;

/* check for duplicate header */
v = rb_hash_aref(hp->request, f);

Expand Down
2 changes: 0 additions & 2 deletions test/test_http11.rb
Expand Up @@ -199,9 +199,7 @@ def test_horrible_queries
end
end

# https://github.com/puma/puma/issues/1890
def test_trims_whitespace_from_headers
skip("Known failure, see issue 1890 on GitHub")
parser = Puma::HttpParser.new
req = {}
http = "GET / HTTP/1.1\r\nX-Strip-Me: Strip This \r\n\r\n"
Expand Down

0 comments on commit b38fbd3

Please sign in to comment.