diff --git a/gunicorn/http/parser.py b/gunicorn/http/parser.py index aa934d04..3e47ec2a 100644 --- a/gunicorn/http/parser.py +++ b/gunicorn/http/parser.py @@ -96,7 +96,11 @@ class Parser(object): """ parse header line""" name, value = line.split(":", 1) name = normalize_name(name.strip()) - hdrs[name] = value.rsplit("\r\n",1)[0].strip() + value = value.rsplit("\r\n",1)[0].strip() + if name in hdrs: + hdrs[name] = "%s, %s" % (hdrs[name], value) + else: + hdrs[name] = value return name @property diff --git a/tests/001-test-parser.py b/tests/001-test-parser.py index 63d99939..81b41e9e 100644 --- a/tests/001-test-parser.py +++ b/tests/001-test-parser.py @@ -192,3 +192,17 @@ def test_011(buf, p): if chunk: body += chunk t.eq(body, "hello world") + +@t.request("017.http") +def test_017(buf, p): + headers = [] + i = p.filter_headers(headers, buf) + t.ne(i, -1) + t.eq(p.method, "GET") + t.eq(p.version, (1, 0)) + t.eq(p.path, "/stuff/here") + t.eq(p.query_string, "foo=bar") + t.eq(p.is_chunked, False) + t.eq(p._chunk_eof, False) + t.eq(p.body_eof(), True) + t.eq(p.headers, [("If-Match", "bazinga!, large-sound")]) diff --git a/tests/requests/017.http b/tests/requests/017.http new file mode 100644 index 00000000..bcbe3cf5 --- /dev/null +++ b/tests/requests/017.http @@ -0,0 +1,4 @@ +GET /stuff/here?foo=bar HTTP/1.0\r\n +If-Match: bazinga!\r\n +If-Match: large-sound\r\n +\r\n