From d4fd801ceebf56fe9204a3b2829138fb4c433d39 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 3 Sep 2009 10:55:11 -0700 Subject: Support HTTP/0.9 entity-body-only responses HTTP/0.9 GET requests expect responses without headers. Some weird applications/tools still use the ancient HTTP/0.9 protocol for weird reasons, so we'll support them. ref: rfc 1945, section 4.1 --- test/unit/test_server.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/unit/test_server.rb b/test/unit/test_server.rb index 0b409ba..fff7f89 100644 --- a/test/unit/test_server.rb +++ b/test/unit/test_server.rb @@ -148,6 +148,16 @@ class WebServerTest < Test::Unit::TestCase assert_nothing_raised { sock.close } end + def test_http_0_9 + sock = nil + assert_nothing_raised do + sock = TCPSocket.new('127.0.0.1', @port) + sock.syswrite("GET /hello\r\n") + end + assert_match 'hello!\n', sock.sysread(4096) + assert_nothing_raised { sock.close } + end + def test_header_is_too_long redirect_test_io do long = "GET /test HTTP/1.1\r\n" + ("X-Big: stuff\r\n" * 15000) + "\r\n" -- cgit v1.2.3-24-ge0c7