summaryrefslogtreecommitdiff
path: root/test/webrick
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-09-10 10:20:35 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-09-10 10:20:35 +0000
commita4fa58f9ab9883a03bf7ed95655501acfb2fa554 (patch)
tree8a7ee68b9b824f8d8cba2c9e6761f0b353cb15ee /test/webrick
parent7f438d8402f53c2f78c5c6512c3d2f68d9fb20ac (diff)
* lib/webrick/httprequest.rb (WEBrick::HTTPRequest#continue): add
method for generating HTTP/1.1 100 continue response if the client expects it, otherwise does nothing. Patch by Brian Candler. ref #855. * test/webrick/test_httprequest.rb: test added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/webrick')
-rw-r--r--test/webrick/test_httprequest.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/webrick/test_httprequest.rb b/test/webrick/test_httprequest.rb
index 4a1db38bca..7869c21795 100644
--- a/test/webrick/test_httprequest.rb
+++ b/test/webrick/test_httprequest.rb
@@ -305,6 +305,37 @@ class TestWEBrickHTTPRequest < Test::Unit::TestCase
assert(req.ssl?)
end
+ def test_continue_sent
+ msg = <<-_end_of_message_
+ POST /path HTTP/1.1
+ Expect: 100-continue
+
+ _end_of_message_
+ msg.gsub!(/^ {6}/, "")
+ req = WEBrick::HTTPRequest.new(WEBrick::Config::HTTP)
+ req.parse(StringIO.new(msg))
+ assert req['expect']
+ l = msg.size
+ req.continue
+ assert_not_equal l, msg.size
+ assert_match /HTTP\/1.1 100 continue\r\n\r\n\z/, msg
+ assert !req['expect']
+ end
+
+ def test_continue_not_sent
+ msg = <<-_end_of_message_
+ POST /path HTTP/1.1
+
+ _end_of_message_
+ msg.gsub!(/^ {6}/, "")
+ req = WEBrick::HTTPRequest.new(WEBrick::Config::HTTP)
+ req.parse(StringIO.new(msg))
+ assert !req['expect']
+ l = msg.size
+ req.continue
+ assert_equal l, msg.size
+ end
+
def test_bad_messages
param = "foo=1;foo=2;foo=3;bar=x"
msg = <<-_end_of_message_