about summary refs log tree commit homepage
path: root/test
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-05-08 22:57:23 +0000
committerEric Wong <normalperson@yhbt.net>2013-05-08 22:57:23 +0000
commit421f5a8573484b1203fceebc65aee5d011d63c63 (patch)
tree79c0a4ae2fafa76369e4a3ffede569c281591822 /test
parentc3c79fcdb71c599e426f9ce83d45dc8cc3d9cd3c (diff)
downloadunicorn-421f5a8573484b1203fceebc65aee5d011d63c63.tar.gz
This could allow servers with persistent connection support[1]
to support our check_client_connection in the future.

[1] - Rainbows!/zbatery, possibly others
Diffstat (limited to 'test')
-rw-r--r--test/unit/test_http_parser_ng.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/unit/test_http_parser_ng.rb b/test/unit/test_http_parser_ng.rb
index 93c44bb..ab335ac 100644
--- a/test/unit/test_http_parser_ng.rb
+++ b/test/unit/test_http_parser_ng.rb
@@ -12,6 +12,23 @@ class HttpParserNgTest < Test::Unit::TestCase
     @parser = HttpParser.new
   end
 
+  def test_next_clear
+    r = "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n"
+    @parser.buf << r
+    @parser.parse
+    @parser.response_start_sent = true
+    assert @parser.keepalive?
+    assert @parser.next?
+    assert @parser.response_start_sent
+
+    # persistent client makes another request:
+    @parser.buf << r
+    @parser.parse
+    assert @parser.keepalive?
+    assert @parser.next?
+    assert_equal false, @parser.response_start_sent
+  end
+
   def test_keepalive_requests_default_constant
     assert_kind_of Integer, HttpParser::KEEPALIVE_REQUESTS_DEFAULT
     assert HttpParser::KEEPALIVE_REQUESTS_DEFAULT >= 0