about summary refs log tree commit homepage
path: root/test
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-10-05 22:01:19 +0000
committerEric Wong <normalperson@yhbt.net>2010-10-05 22:08:21 +0000
commit350e8fa3a94838bcc936782315b3472615fe6517 (patch)
tree2e989526cc59d071be5a91fd124a461dbb2ddd4d /test
parentc2975b85b9378797631d3ab133cac371f9fadf54 (diff)
downloadunicorn-350e8fa3a94838bcc936782315b3472615fe6517.tar.gz
It's expensive to generate a backtrace and this exception
is only triggered by bad clients.  So make it harder for
them to DoS us by sending bad requests.
Diffstat (limited to 'test')
-rw-r--r--test/unit/test_http_parser_ng.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/unit/test_http_parser_ng.rb b/test/unit/test_http_parser_ng.rb
index cb30f32..8e8c933 100644
--- a/test/unit/test_http_parser_ng.rb
+++ b/test/unit/test_http_parser_ng.rb
@@ -440,6 +440,17 @@ class HttpParserNgTest < Test::Unit::TestCase
     end
   end
 
+  def test_backtrace_is_empty
+    begin
+      @parser.headers({}, "AAADFSFDSFD\r\n\r\n")
+      assert false, "should never get here line:#{__LINE__}"
+    rescue HttpParserError => e
+      assert_equal [], e.backtrace
+      return
+    end
+    assert false, "should never get here line:#{__LINE__}"
+  end
+
   def test_ignore_version_header
     http = "GET / HTTP/1.1\r\nVersion: hello\r\n\r\n"
     req = {}