summaryrefslogtreecommitdiff
path: root/test/webrick/test_httpserver.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/webrick/test_httpserver.rb')
-rw-r--r--test/webrick/test_httpserver.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/webrick/test_httpserver.rb b/test/webrick/test_httpserver.rb
index daeb7b955e..070422f48c 100644
--- a/test/webrick/test_httpserver.rb
+++ b/test/webrick/test_httpserver.rb
@@ -440,4 +440,21 @@ class TestWEBrickHTTPServer < Test::Unit::TestCase
s&.shutdown
th&.join
end
+
+ def test_gigantic_request_header
+ log_tester = lambda {|log, access_log|
+ assert_equal 1, log.size
+ assert log[0].include?('ERROR headers too large')
+ }
+ TestWEBrick.start_httpserver({}, log_tester){|server, addr, port, log|
+ server.mount('/', WEBrick::HTTPServlet::FileHandler, __FILE__)
+ TCPSocket.open(addr, port) do |c|
+ c.write("GET / HTTP/1.0\r\n")
+ junk = -"X-Junk: #{' ' * 1024}\r\n"
+ assert_raise(Errno::ECONNRESET, Errno::EPIPE) do
+ loop { c.write(junk) }
+ end
+ end
+ }
+ end
end