1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/cgi.rb: not use const if GET, HEAD. check multipart form head.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
wakou 2002-05-29 04:48:32 +00:00
parent bab153b243
commit 99551555c8
2 changed files with 29 additions and 22 deletions

View file

@ -1,3 +1,7 @@
Wed May 29 13:45:15 2002 Wakou Aoyama <wakou@ruby-lang.org>
* lib/cgi.rb: not use const if GET, HEAD. check multipart form head.
Tue May 28 12:13:37 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net> Tue May 28 12:13:37 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* eval.c (scope_node): trick to keep the node has a scope. * eval.c (scope_node): trick to keep the node has a scope.

View file

@ -8,7 +8,7 @@ Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agency, Japan Copyright (C) 2000 Information-technology Promotion Agency, Japan
Wakou Aoyama <wakou@fsinet.or.jp> Wakou Aoyama <wakou@ruby-lang.org>
@ -775,10 +775,6 @@ convert string charset, and set language to "ja".
@params.update(hash) @params.update(hash)
end end
def param(name)
@params[name].join("\0")
end
def read_multipart(boundary, content_length) def read_multipart(boundary, content_length)
params = Hash.new([]) params = Hash.new([])
boundary = "--" + boundary boundary = "--" + boundary
@ -792,6 +788,8 @@ convert string charset, and set language to "ja".
status = stdinput.read(boundary_size) status = stdinput.read(boundary_size)
if nil == status if nil == status
raise EOFError, "no content body" raise EOFError, "no content body"
elsif boundary + EOL != status
raise EOFError, "bad content body"
end end
require "tempfile" require "tempfile"
@ -1892,13 +1890,27 @@ The hash keys are case sensitive. Ask the samples.
def initialize(type = "query") def initialize(type = "query")
extend QueryExtension extend QueryExtension
if defined?(CGI_PARAMS) if "POST" != env_table['REQUEST_METHOD']
@params = CGI_PARAMS.nil? ? nil : CGI_PARAMS.dup
@cookies = CGI_COOKIES.nil? ? nil : CGI_COOKIES.dup
else
initialize_query() # set @params, @cookies initialize_query() # set @params, @cookies
eval "CGI_PARAMS = @params.nil? ? nil : @params.dup" else
eval "CGI_COOKIES = @cookies.nil? ? nil : @cookies.dup" if defined?(CGI_PARAMS)
@params = CGI_PARAMS.nil? ? nil : CGI_PARAMS.dup
@cookies = CGI_COOKIES.nil? ? nil : CGI_COOKIES.dup
else
initialize_query() # set @params, @cookies
eval "CGI_PARAMS = @params.nil? ? nil : @params.dup"
eval "CGI_COOKIES = @cookies.nil? ? nil : @cookies.dup"
if defined?(MOD_RUBY) and (RUBY_VERSION < "1.4.3")
raise "Please, use ruby1.4.3 or later."
else
at_exit() do
if defined?(CGI_PARAMS)
remove_const(:CGI_PARAMS)
remove_const(:CGI_COOKIES)
end
end
end
end
end end
@output_cookies = nil @output_cookies = nil
@output_hidden = nil @output_hidden = nil
@ -1925,17 +1937,6 @@ The hash keys are case sensitive. Ask the samples.
end end
end end
if defined?(MOD_RUBY) and (RUBY_VERSION < "1.4.3")
raise "Please, use ruby1.4.3 or later."
else
at_exit() do
if defined?(CGI_PARAMS)
remove_const(:CGI_PARAMS)
remove_const(:CGI_COOKIES)
end
end
end
end end
@ -1947,3 +1948,5 @@ delete. see cvs log.
=end =end
# vi:set tw=0: