about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2014-09-03 17:27:06 +0000
committerEric Wong <e@80x24.org>2014-09-03 17:27:06 +0000
commit6ac46bfadaf61d89149e215ad6dcff76ee1a90ae (patch)
tree8a7524caf2ab0aa1d81170699cad59510d5f151e
parent4fbe02062007d1ad073a550f5e37b599fc0019e4 (diff)
downloadcmogstored-empty-header-values.tar.gz
-rw-r--r--http_common.rl2
-rw-r--r--test/http.rb14
2 files changed, 15 insertions, 1 deletions
diff --git a/http_common.rl b/http_common.rl
index a0fdd5a..4df7f42 100644
--- a/http_common.rl
+++ b/http_common.rl
@@ -10,7 +10,7 @@
         eor = LWS*'\r'LF;
         CTL = (cntrl | 127);
         header_name = [a-zA-Z0-9\-]+;
-        header_value = (any -- (LWS|CTL))(any -- CTL)*;
+        header_value = (any -- CTL)*;
         sep = (LWS*)|(eor LWS+);
         b64_val = ([a-zA-Z0-9/+]{22}) > {
                         http->_p.tmp_tip = to_u16(fpc - buf);
diff --git a/test/http.rb b/test/http.rb
index e23bddf..892e2db 100644
--- a/test/http.rb
+++ b/test/http.rb
@@ -38,6 +38,20 @@ class TestHTTP < Test::Unit::TestCase
     assert status.success?, status.inspect
   end
 
+  # neon does this
+  def test_empty_request_value
+    @client.write("GET / HTTP/1.1\r\n" \
+                  "Keep-Alive: \r\nConnection: TE,Keep-Alive\r\n\r\n")
+    buf = @client.readpartial(12345)
+    assert_match(%r{\AHTTP/1\.1 200 OK}, buf)
+
+    # ensure persistent connections work
+    @client.write("GET / HTTP/1.1\r\n" \
+                  "Missing-Space:\r\n\r\n")
+    buf = @client.readpartial(12345)
+    assert_match(%r{\AHTTP/1\.1 200 OK}, buf)
+  end
+
   def test_slash_for_mogadm_check
     Net::HTTP.start(@host, @port) do |http|
       [ Net::HTTP::Get, Net::HTTP::Head ].each do |meth|