diff options
author | Eric Wong <e@80x24.org> | 2014-09-07 02:40:44 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2014-09-17 03:15:25 +0000 |
commit | 4b2782a926d8f131b1e7382be35e3abb77bf4be5 (patch) | |
tree | 31e3a624681fe164cb563658039d81025ffb2de2 /test/unit | |
parent | b068871e4ca352048faf8db13d600ccdc429718d (diff) | |
download | unicorn-4b2782a926d8f131b1e7382be35e3abb77bf4be5.tar.gz |
This allows the parser struct to fit in one cache line on x86-64 systems where cache lines are 64 bytes. Using 32-bit integer lengths is safe here because these are only for tracking offsets within the HTTP header buffer. We can safely limit HTTP headers and in-memory buffers to be less than 4GB without anybody complaining. HTTP bodies continue to use off_t (usually 64-bit, even on 32-bit systems) sizes and support as much as the OS/hardware can handle.
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/test_http_parser_ng.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/unit/test_http_parser_ng.rb b/test/unit/test_http_parser_ng.rb index 9167845..d5c8d2e 100644 --- a/test/unit/test_http_parser_ng.rb +++ b/test/unit/test_http_parser_ng.rb @@ -11,6 +11,12 @@ class HttpParserNgTest < Test::Unit::TestCase @parser = HttpParser.new end + def test_parser_max_len + assert_raises(RangeError) do + HttpParser.max_header_len = 0xffffffff + 1 + end + end + def test_next_clear r = "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n" @parser.buf << r |