mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/webrick/cgi.rb (WEBrick::CGI#setup_header): avoid
SecurityError. [ruby-dev:24970] * lib/webrick/httpserver.rb (WEBrick::HTTPServer#run): should wait for reading request till data arrive. [ruby-talk:121068] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e326946b35
commit
3f06be1b9d
3 changed files with 24 additions and 10 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
Thu Dec 9 16:21:51 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
||||||
|
|
||||||
|
* lib/webrick/cgi.rb (WEBrick::CGI#setup_header): avoid
|
||||||
|
SecurityError. [ruby-dev:24970]
|
||||||
|
|
||||||
|
* lib/webrick/httpserver.rb (WEBrick::HTTPServer#run): should wait
|
||||||
|
for reading request till data arrive. [ruby-talk:121068]
|
||||||
|
|
||||||
Thu Dec 9 14:38:35 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Thu Dec 9 14:38:35 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* string.c (rb_str_inspect): escape # which starts an expression
|
* string.c (rb_str_inspect): escape # which starts an expression
|
||||||
|
|
|
@ -158,20 +158,19 @@ module WEBrick
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup_header
|
def setup_header
|
||||||
add_header("CONTENT_TYPE", "Content-Type")
|
@env.each{|key, value|
|
||||||
add_header("CONTENT_LENGTH", "Content-length")
|
case key
|
||||||
@env.each_key{|name|
|
when "CONTENT_TYPE", "CONTENT_LENGTH"
|
||||||
if /^HTTP_(.*)/ =~ name
|
add_header(key.gsub(/_/, "-"), value)
|
||||||
add_header(name, $1.gsub(/_/, "-"))
|
when /^HTTP_(.*)/
|
||||||
|
add_header($1.gsub(/_/, "-"), value)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_header(envname, hdrname)
|
def add_header(hdrname, value)
|
||||||
if value = @env[envname]
|
unless value.empty?
|
||||||
unless value.empty?
|
@header_part << hdrname << ": " << value << CRLF
|
||||||
@header_part << hdrname << ": " << value << CRLF
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,13 @@ module WEBrick
|
||||||
req = HTTPRequest.new(@config)
|
req = HTTPRequest.new(@config)
|
||||||
server = self
|
server = self
|
||||||
begin
|
begin
|
||||||
|
timeout = @config[:RequestTimeout]
|
||||||
|
while timeout > 0
|
||||||
|
break if IO.select([sock], nil, nil, 0.5)
|
||||||
|
timeout = 0 if @status != :Running
|
||||||
|
timeout -= 0.5
|
||||||
|
end
|
||||||
|
raise HTTPStatus::EOFError if timeout <= 0
|
||||||
req.parse(sock)
|
req.parse(sock)
|
||||||
res.request_method = req.request_method
|
res.request_method = req.request_method
|
||||||
res.request_uri = req.request_uri
|
res.request_uri = req.request_uri
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue