From 1b1029efa7089a8a3628286fe006b1fc1ae8601e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 6 Sep 2009 14:29:57 -0700 Subject: http: ignore Host: continuation lines with absolute URIs This probably doesn't affect anyone with HTTP/1.1, but future versions of HTTP will use absolute URIs and maybe we'll eventually get clients that (mistakenly) send us Host: headers along with absolute URIs. --- test/unit/test_http_parser.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/unit') diff --git a/test/unit/test_http_parser.rb b/test/unit/test_http_parser.rb index 5ba0239..7475de5 100644 --- a/test/unit/test_http_parser.rb +++ b/test/unit/test_http_parser.rb @@ -180,6 +180,17 @@ class HttpParserTest < Test::Unit::TestCase assert_equal 'hi y x ASDF', req['HTTP_X_ASDF'] end + def test_continuation_with_absolute_uri_and_ignored_host_header + parser = HttpParser.new + header = "GET http://example.com/ HTTP/1.1\r\n" \ + "Host: \r\n" \ + " YHBT.net\r\n" \ + "\r\n" + req = {} + assert_equal req, parser.headers(req, header) + assert_equal 'example.com', req['HTTP_HOST'] + end + # this may seem to be testing more of an implementation detail, but # it also helps ensure we're safe in the presence of multiple parsers # in case we ever go multithreaded/evented... -- cgit v1.2.3-24-ge0c7