diff options
author | Eric Wong <e@80x24.org> | 2014-09-03 17:27:06 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2014-09-03 17:27:06 +0000 |
commit | 6ac46bfadaf61d89149e215ad6dcff76ee1a90ae (patch) | |
tree | 8a7524caf2ab0aa1d81170699cad59510d5f151e | |
parent | 4fbe02062007d1ad073a550f5e37b599fc0019e4 (diff) | |
download | cmogstored-empty-header-values.tar.gz |
-rw-r--r-- | http_common.rl | 2 | ||||
-rw-r--r-- | test/http.rb | 14 |
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| |