From a4fa58f9ab9883a03bf7ed95655501acfb2fa554 Mon Sep 17 00:00:00 2001 From: nahi Date: Fri, 10 Sep 2010 10:20:35 +0000 Subject: * 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 --- lib/webrick/httprequest.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/webrick') diff --git a/lib/webrick/httprequest.rb b/lib/webrick/httprequest.rb index 28be9fd790..75d26b529a 100644 --- a/lib/webrick/httprequest.rb +++ b/lib/webrick/httprequest.rb @@ -122,6 +122,15 @@ module WEBrick end end + # Generate HTTP/1.1 100 continue response if the client expects it, + # otherwise does nothing. + def continue + if self['expect'] == '100-continue' && @config[:HTTPVersion] >= "1.1" + @socket << "HTTP/#{@config[:HTTPVersion]} 100 continue#{CRLF}#{CRLF}" + @header.delete('expect') + end + end + def body(&block) block ||= Proc.new{|chunk| @body << chunk } read_body(@socket, block) -- cgit v1.2.3