From e6336cdacfc8d0ca63fdd786952b2ae9f9000cd7 Mon Sep 17 00:00:00 2001 From: evanweaver Date: Mon, 15 Oct 2007 18:00:40 +0000 Subject: fix #14086 git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@650 19e92222-5c0b-0410-8929-a290d50e31e9 --- test/test_http11.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test') diff --git a/test/test_http11.rb b/test/test_http11.rb index fad7cbd..3afa8c1 100644 --- a/test/test_http11.rb +++ b/test/test_http11.rb @@ -19,10 +19,21 @@ class HttpParserTest < Test::Unit::TestCase req = {} http = "GET / HTTP/1.1\r\n\r\n" nread = parser.execute(req, http, 0) + assert nread == http.length, "Failed to parse the full HTTP request" assert parser.finished?, "Parser didn't finish" assert !parser.error?, "Parser had error" assert nread == parser.nread, "Number read returned from execute does not match" + + assert_equal 'HTTP/1.1', req['SERVER_PROTOCOL'] + assert_equal '/', req['REQUEST_PATH'] + assert_equal 'HTTP/1.1', req['HTTP_VERSION'] + assert_equal '/', req['REQUEST_URI'] + assert_equal 'CGI/1.2', req['GATEWAY_INTERFACE'] + assert_equal 'GET', req['REQUEST_METHOD'] + assert_nil req['FRAGMENT'] + assert_nil req['QUERY_STRING'] + parser.reset assert parser.nread == 0, "Number read after reset should be 0" end @@ -62,6 +73,17 @@ class HttpParserTest < Test::Unit::TestCase assert parser.error?, "Parser SHOULD have error" end + def test_fragment_in_uri + parser = HttpParser.new + req = {} + get = "GET /forums/1/topics/2375?page=1#posts-17408 HTTP/1.1\r\n\r\n" + assert_nothing_raised do + parser.execute(req, get, 0) + end + assert parser.finished? + assert_equal 'posts-17408', req['FRAGMENT'] + end + # lame random garbage maker def rand_data(min, max, readable=true) count = min + ((rand(max)+1) *10).to_i -- cgit v1.2.3-24-ge0c7