Re: cgi.rb$B:F9=C[0F(B

e$B7,ED$H$$$$$^$9!#e(B

e$B$k$S$-$A$G$9!#e(B

cgi.rbe$B$Ne(BCGI::TagMakere$B!“e(BCGI::HtmlExtensione$BEy$r;H$C$F$$$k?M$O$$$k$G$7$g$&$+!)e(B
e$B$”$^$j;H$o$l$F$$$J$$$N$G$"$l$P!"e(Bcgi/html.rbe$B$H$+$KJ,N%$7$?$[$&$,$$$$5$$,$7$^$9!#e(B

e$B$^$?!"e(BCGI::escapee$B7O$Oe(Bcgi/escape.rbe$B$KJ,N%$7$F!"e(Bcgi.rbe$B$Ge(Brequiree$B$9$l$Pe(B
cgi/escapee$BC1FH$G;HMQ$9$k>l9g$O%3%s%Q%/%H$K$J$j$^$9!#$I$&$G$7$g$&$+!)e(B

e$B;29M$^$G$K!"e(Bcgi.rbe$B$r=q$-49$($?e(B CGIAlt
e$B$H$$$&$N$r:n$C$F$^$9!#e(B
http://cgialt.rubyforge.org/

cgi.rbe$B$r0J2<$N$h$&$KJ,2r$7$F$^$9!#e(B

  • cgialt.rb
  • cgialt/core.rb
  • cgialt/util.rb
  • cgialt/cookie.rb
  • cgialt/html.rb

e$B$^$?e(B CGI.escapeHTML e$B$de(B CGI.unescape
e$B$r3HD%%i%$%V%i%j$G=q$-D>$7$F$$$^$9!#e(B
http://cgiext.rubyforge.org/

e$B=q$-D>$7$FJ,$+$C$?$3$He(B:

(1) CGI.unescape() e$B$,CY$$$;$$$G!“e(Brequest parameter e$B$de(B cookie
e$B$Ne(B
e$B%G%3!<%I$,CY$$e(B
e$B”*e(B e$B2r7h:ve(B: CGI.unescape()
e$B$r3HD%%i%$%V%i%j$G=q$-D>$9e(B
(2) CGI.escapeHTML() e$B$,CY$$$N$G!“e(BPHPe$B$Ne(B htmlspecialchars()
e$B$HHf$Y$FITMxe(B
e$B”*e(B e$B2r7h:ve(B: CGI.escapeHTML()
e$B$r3HD%%i%$%V%i%j$G=q$-D>$9e(B
(3) CGI::Cookie class e$B$,e(B DelegateClass(Array)
e$B$r;H$C$F$$$k$;$$$G!“e(B
require ‘cgi’ e$B$K$9$4$/;~4V$,$+$+$ke(B (ruby
e$B$N5/F0$h$j;~4V$,$+$+$ke(B)e$B!#e(B
(e$B;~4V$,$+$+$k$N$Oe(B CGI::HtmlExtention
e$B$^$o$j$N$;$$$G$O$J$$e(B)
e$B”*e(B e$B2r7h:ve(B: DelegateClass(Array)
e$B$r;H$o$J$$$h$&$K=q$-49$($ke(B
(4) multipart e$B$N$H$-$K!"%G!<%?%5%$%:$r3NG’$;$:<u?.$7$F$k$N$G!“e(B
e$B6K$a$FBg$-$$%U%!%$%k$rAw?.$5$l$k$H%5!<%P;q8;$r?)$$$D$V$9e(B
e$B”*e(B e$B2r7h:ve(B: e$B<u?.$9$k%G!<%?%5%$%:$N>[email protected]_Dj$9$ke(B
(5) multipart e$B$N$H$-$K!“e(Bfilename
e$B$N$”$k!&$J$7$K4X78$J$/!“CM$re(B
Tempfile e$B$de(B StringIO e$B$K3JG<$7$F$$$k!#K\Mh$J$ie(B filename
e$B$Ne(B
e$B$”$kCM$N$_e(B Tempfile e$B$r;H$$!"$=$&$G$J$$$J$iIaDL$Ke(B String
e$B$Ge(B
e$B$h$$$O$:e(B
e$B"*e(B e$B2r7h:ve(B:
e$B%$%s%?!<%U%’!<%9$rJQ$($J$$$H$$$1$J$$$N$G!"2r7h$OFq$7$$e(B
(6) CGI#initialize() e$B$NCf$Ge(B ENV[‘QUERY_STRING’] e$B$de(B
ENV[‘HTTP_COOKIE’] e$B$re(B
parse e$B$7$F$$$k$N$G!"e(BFastCGI e$B$N$h$&$Ke(B ENV
e$B$r;H$o$J$$>l9g!"e(B
cgi.rb e$B$r;H$&$N$,:$Fqe(B
(e$B<B:]!“e(Bfcgi.rb e$B$G$Ne(B cgi.rb
e$BBP:v$OHa;4$J%3!<%I$K$J$C$F$$$ke(B)
e$B”*e(B e$B2r7h:ve(B: workaround e$B$H$7$F!“e(B$ENV = ENV
e$B$r$7$F$+$i!“e(B
CGI#initialize() e$B$G$Oe(B ENV e$B$N$+$o$j$Ke(B $ENV
e$B$r;H$&$h$&$KJQ99e(B
(7) mod_ruby e$BBP1~$,$d$C$D$1;E;v$G8zN($,0-$$e(B
e$B”*e(B e$B2r7h:ve(B: e$B:G=i$+$ie(B mod_ruby
e$BBP1~$r9M$($F=q$-D>$9e(B
(8) e$B%F%9%H%9%/%j%W%H$,$^$C$?$/MQ0U$5$l$F$$$J$$e(B
e$B”*e(B e$B2r7h:ve(B: e$BCOF;$K%F%9%H%9%/%j%W%H$r=q$/e(B (CGIAlt
e$B$K$OE:IU:Qe(B)

(1)e$B$He(B(2)e$B$Oe(B pure Ruby
e$B$G$O2r7h$7$K$/$$LdBj$J$N$G!“3HD%%i%$%V%i%j$re(B
e$B;H$&$N$,$$$$$H;W$$$^$9!#$H$$$&$+!”%Q%U%)!<%^%s%9$N$?$a$K4pK\E*$Je(B
e$B4X?t$O3HD%%i%$%V%i%j$GDs6!$7$F$[$7$$$H$3$m$G$9!#e(B

(3)e$B$He(B(4)e$B$He(B(8)e$B$O:#$9$0$K$G$b2r7h$G$-$kLdBj$J$N$G!"BP1~$r8!F$$7$Fe(B
[email protected]$1$k$H$&$l$7$$$G$9!#e(B

e$B0JA0!"e(B(8) e$B$rDs0F$7$?$H$-$K$^$C$?$/[email protected]$C$?$N$G$9$,!"e(B

e$BC/$b6=L#$J$$$N$G$7$g$&$+!#e(B

e$B=q$-D>$7$F;W$C$?$N$O!"e(Bcgi.rbe$B$r=q$-D>$7$?$H$3$m$GNI$/$J$i$J$$$He(B
e$B$$$&$3$H$G$9!#e(B1.9 e$B$r8+?x$($F!"e(Bcgi.rb
e$B$NBeBXJ*$r9-$/8xJg$7$F$Oe(B
e$B$$$+$,$G$7$g$&$+!#e(B
PHP e$B$re(B dis e$B$C$F$k>l9g$8$c$J$$$G$9!#e(B

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:33580] Re: cgi.rbe$B:F9=C[0Fe(B”
on Mon, 4 Feb 2008 04:40:16 +0900, “Makoto Kuwata”
[email protected] writes:

|(3)e$B$He(B(4)e$B$He(B(8)e$B$O:#$9$0$K$G$b2r7h$G$-$kLdBj$J$N$G!"BP1~$r8!F$$7$Fe(B
|[email protected]$1$k$H$&$l$7$$$G$9!#e(B
|# e$B0JA0!"e(B(8) e$B$rDs0F$7$?$H$-$K$^$C$?$/[email protected]$C$?$N$G$9$,!"e(B
|# e$BC/$b6=L#$J$$$N$G$7$g$&$+!#e(B

e$B%Q%C%A$rMQ0U$7$F$/[email protected]$5$l$P<h$j9~$_$^$9!#e(B

|e$B=q$-D>$7$F;W$C$?$N$O!"e(Bcgi.rbe$B$r=q$-D>$7$?$H$3$m$GNI$/$J$i$J$$$He(B
|e$B$$$&$3$H$G$9!#e(B1.9 e$B$r8+?x$($F!"e(Bcgi.rb e$B$NBeBXJ*$r9-$/8xJg$7$F$Oe(B
|e$B$$$+$,$G$7$g$&$+!#e(B

e$B8xJg$7$^$9!#e(B

|PHP e$B$re(B dis e$B$C$F$k>l9g$8$c$J$$$G$9!#e(B

cgi.rbe$B$N2~A1$K;[email protected]$O$"$^$j4X78$J$$$H;W$$$^$9$1$I!#e(B

From: “Makoto Kuwata” [email protected]
Subject: [ruby-dev:33580] Re: cgi.rbe$B:F9=C[0Fe(B
Date: Mon, 4 Feb 2008 04:40:16 +0900

e$B$^$?e(B CGI.escapeHTML e$B$de(B CGI.unescape e$B$r3HD%%i%$%V%i%j$G=q$-D>$7$F$$$^$9!#e(B
http://cgiext.rubyforge.org/

e$B8E$$$G$9$,e(BMoonWolfe$B$5$s$Ne(Bfastesce$B$H$$$&$N$b$"$j$^$9$M!#e(B

e$B9bB.2=$H$$$($P!"e(Berubise$B$,I8=`E:IU$5$l$k$H9,$;$K$J$k?M$,B?$$$H;W$$$^$9!#e(B

e$B$H$_$?$G$9!#e(B

e$B:,K\E*$JLdBj$N2r7h$NOC$G$O$J$$$G$9$1$I!"e(BCGI#[]
e$B$,JV$9$N$OIaDL$NJ8;zNs$Ke(B
e$B$7$F!"e(BCGI#[][] e$B$H$+$Ge(B warning e$B$,=P$k$N$O!"e(B1.9
e$B$G$O$b$&$d$a$^$7$g$&!#e(B

Index: lib/cgi.rb

— lib/cgi.rb (e$B%j%S%8%g%se(B 15370)
+++ lib/cgi.rb (e$B:n6H%3%T!<e(B)
@@ -1178,29 +1178,6 @@
@multipart
end

  • module Value # :nodoc:
  •  def set_params(params)
    
  •    @params = params
    
  •  end
    
  •  def [](idx, *args)
    
  •    if args.size == 0
    
  •      warn "#{caller(1)[0]}:CAUTION! cgi['key'] == 
    

cgi.params[‘key’][0]; if want Array, use cgi.params[‘key’]"

  •      @params[idx]
    
  •    else
    
  •      super[idx,*args]
    
  •    end
    
  •  end
    
  •  def first
    
  •    warn "#{caller(1)[0]}:CAUTION! cgi['key'] == 
    

cgi.params[‘key’][0]; if want Array, use cgi.params[‘key’]"

  •    self
    
  •  end
    
  •  alias last first
    
  •  def to_a
    
  •    @params || [self]
    
  •  end
    
  •  alias to_ary to_a     # to be rhs of multiple assignment
    
  • end
  • Get the value for the parameter with a given key.

    If the parameter has multiple values, only the first will be

@@ -1219,8 +1196,6 @@
end
else
str = if value then value.dup else “” end

  •    str.extend(Value)
    
  •    str.set_params(params)
       str
     end
    
    end

[email protected]$G$9!#e(B

At Mon, 4 Feb 2008 04:40:16 +0900,
Makoto Kuwata wrote in [ruby-dev:33580]:

(3) CGI::Cookie class e$B$,e(B DelegateClass(Array) e$B$r;H$C$F$$$k$;$$$G!“e(B
require ‘cgi’ e$B$K$9$4$/;~4V$,$+$+$ke(B (ruby e$B$N5/F0$h$j;~4V$,$+$+$ke(B)e$B!#e(B
(e$B;~4V$,$+$+$k$N$Oe(B CGI::HtmlExtention e$B$^$o$j$N$;$$$G$O$J$$e(B)
e$B”*e(B e$B2r7h:ve(B: DelegateClass(Array) e$B$r;H$o$J$$$h$&$K=q$-49$($ke(B

cgi.rbe$B$H$OJL$K!"$3$l$b2~A1$9$k$[$&$,$$$$$G$7$g$&!#860x$O!":Y$+$/e(B
module_evale$B$r7+$jJV$9$3$H$K$"$k$h$&$G$9!#e(B

e$B%a%=%C%[email protected]$7$$<1JL;R$+D4$Y$k%a%=%C%I$H$$$&$b$N$rMQ0U$7$?$[e(B
e$B$&$,4JC1$+$b!#e(B

Index: lib/delegate.rb

— lib/delegate.rb (revision 15366)
+++ lib/delegate.rb (working copy)
@@ -143,5 +143,5 @@ class Delegator
end
rescue Exception

#`

=~ s}
::Kernel::raise
end
@@ -279,7 +279,11 @@ def DelegateClass(superclass)
end
}

  • for method in methods
  • begin
  •  klass.module_eval <<-EOS, __FILE__, __LINE__+1
    
  • src = []
  • line = LINE+3
  • if method = methods.find {|m|
    %r"\A(?:(?!\d)\w+[=!?]?|[-+]@?|*{1,2}|[/|&^]|<(?:<|=>?)|>[>=]|~|=(?:~|==?)|![~=]?|[]=?)\z"
    !~ m}
  • raise NameError, “invalid identifier %s” % method, caller(0)
  • end
  • methods.each do |method|
  • src << <<-EOS
    def #{method}(*args, &block)
    begin
    @@ -289,9 +293,7 @@ def DelegateClass(superclass)
    end
    end
  •  EOS
    
  • rescue SyntaxError
  •  raise NameError, "invalid identifier %s" % method, caller(3)
    
  • end
  • EOS
    end
  • klass.module_eval(src.join, FILE, line)
    return klass
    end

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:33592] Re: performance improvement of
DelegateClass (was cgi.rbe$B:F9=C[0Fe(B)”
on Mon, 4 Feb 2008 13:57:19 +0900, Nobuyoshi N.
[email protected] writes:

|At Mon, 4 Feb 2008 10:09:21 +0900,
|> e$B%a%=%C%[email protected]$7$$<1JL;R$+D4$Y$k%a%=%C%I$H$$$&$b$N$rMQ0U$7$?$[e(B
|> e$B$&$,4JC1$+$b!#e(B
|
|Symbol#inspecte$B$,%/%)!<%H$5$l$F$$$k$+$GD4$Y$i$l$k$+$J$H;W$C$?$s$Ge(B
|e$B$9$,!“e(B:!e$B$He(B:!=e$B$,L$BP1~$G$7$?!#BP1~$7$?$[$&$,$$$$$h$&$J5$$b$7$^$9e(B
|e$B$,!“e(B1.9e$B$Ge(B:”!”.inspecte$B$7$?7k2L$re(B1.8e$B$Ge(Bevale$B$G$-$J$/$J$j$^$9!#$I$C$Ae(B
|e$B$K$$$$$G$9$+$M$’!#e(B

e$BBP1~$7$?J}$,$h$$$G$7$g$&$M!#%3%_%C%H$7$F$/[email protected]$5$$!#e(B

[email protected]$G$9!#e(B

At Mon, 4 Feb 2008 10:09:21 +0900,

e$B%a%=%C%[email protected]$7$$<1JL;R$+D4$Y$k%a%=%C%I$H$$$&$b$N$rMQ0U$7$?$[e(B
e$B$&$,4JC1$+$b!#e(B

Symbol#inspecte$B$,%/%)!<%H$5$l$F$$$k$+$GD4$Y$i$l$k$+$J$H;W$C$?$s$Ge(B
e$B$9$,!“e(B:!e$B$He(B:!=e$B$,L$BP1~$G$7$?!#BP1~$7$?$[$&$,$$$$$h$&$J5$$b$7$^$9e(B
e$B$,!“e(B1.9e$B$Ge(B:”!”.inspecte$B$7$?7k2L$re(B1.8e$B$Ge(Bevale$B$G$-$J$/$J$j$^$9!#$I$C$Ae(B
e$B$K$$$$$G$9$+$M$’!#e(B

Index: parse.y

— parse.y (revision 15371)
+++ parse.y (working copy)
@@ -8907,4 +8907,12 @@ rb_enc_symname2_p(const char *name, int
break;

  •  case '!':
    
  • switch (*++m) {
  • case ‘\0’: return Qtrue;
  • case ‘=’: case ‘~’: ++m; break;
  • default: return Qfalse;
  • }
  • break;
  •  default:
    
    localid = !rb_enc_isupper(*m, enc);

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:33595] Re: performance improvement of
DelegateClass (was cgi.rbe$B:F9=C[0Fe(B)”
on Mon, 4 Feb 2008 16:16:08 +0900, Nobuyoshi N.
[email protected] writes:

|e$B$I$&$d$i!“e(Bdefine_methode$B$r;H$&$N$,0lHVB.$$$h$&$G$9!#e(B
|DelegateClasse$B$O==?tG!”<[email protected]=$O$[$\F1$8$/$i$$$G$9!#e(B

e$B%3%_%C%H$7$F$/[email protected]$5$$!#e(B

[email protected]$G$9!#e(B

At Mon, 4 Feb 2008 14:27:53 +0900,
Yukihiro M. wrote in [ruby-dev:33593]:

|> e$B%a%=%C%[email protected]$7$$<1JL;R$+D4$Y$k%a%=%C%I$H$$$&$b$N$rMQ0U$7$?$[e(B
|> e$B$&$,4JC1$+$b!#e(B
|
|Symbol#inspecte$B$,%/%)!<%H$5$l$F$$$k$+$GD4$Y$i$l$k$+$J$H;W$C$?$s$Ge(B
|e$B$9$,!“e(B:!e$B$He(B:!=e$B$,L$BP1~$G$7$?!#BP1~$7$?$[$&$,$$$$$h$&$J5$$b$7$^$9e(B
|e$B$,!“e(B1.9e$B$Ge(B:”!”.inspecte$B$7$?7k2L$re(B1.8e$B$Ge(Bevale$B$G$-$J$/$J$j$^$9!#$I$C$Ae(B
|e$B$K$$$$$G$9$+$M$’!#e(B

e$BBP1~$7$?J}$,$h$$$G$7$g$&$M!#%3%_%C%H$7$F$/[email protected]$5$$!#e(B

e$B$I$&$d$i!“e(Bdefine_methode$B$r;H$&$N$,0lHVB.$$$h$&$G$9!#e(B
DelegateClasse$B$O==?tG!”<[email protected]=$O$[$\F1$8$/$i$$$G$9!#e(B

Index: lib/delegate.rb

— lib/delegate.rb (revision 15373)
+++ lib/delegate.rb (working copy)
@@ -144,5 +144,5 @@ class Delegator
end
rescue Exception

#`

=~ s}
::Kernel::raise
end
@@ -247,7 +247,13 @@ end

:stopdoc:

-# backward compatibility ^_^;;;
-Delegater = Delegator
-SimpleDelegater = SimpleDelegator
+def Delegator.delegating_block(mid)

  • lambda do |*args, &block|
  • begin
  •  @delegate_dc_obj.__send__(mid, *args, &block)
    
  • rescue
  •  raise $!, [email protected][2..-1]
    
  • end
  • end
    +end

:startdoc:

@@ -281,18 +287,13 @@ def DelegateClass(superclass)
end
}

  • for method in methods
  • begin
  •  klass.module_eval <<-EOS, __FILE__, __LINE__+1
    
  •    def #{method}(*args, &block)
    
  • begin
  •  @delegate_dc_obj.__send__(:#{method}, *args, &block)
    
  • rescue
  •  raise $!, [email protected][2..-1]
    
  • end
  • end
  •  EOS
    
  • rescue SyntaxError
  •  raise NameError, "invalid identifier %s" % method, caller(3)
    
  • method = nil
  • begin
  • klass.module_eval do
  •  methods.each do |mid|
    
  •    define_method(mid, Delegator.delegating_block(mid))
    
  •  end
    
    end
  • rescue SyntaxError
  • raise NameError, “invalid identifier %s” % method, caller(3)
    end
    return klass

Rubyist e$B6e=#$N?70f$G$9!#e(B

[email protected],@O!"[email protected]$i$7$$$G$9$M!#e(B
CGI.rbe$B$N%X%S!<%f!<%6$H$7$Fe(B
(3)(4)(8)e$B$N%Q%C%A$r3Z$7$_$K$7$F$$$^$9!#e(B

e$B$h$/;H$&4X?t$N3HD%%i%$%V%i%j2=$b$$$$$G$9$M!#e(B

e$B7,ED$H$$$$$^$9!#e(B

2008/2/4 [email protected]:

e$B9bB.2=$H$$$($P!"e(Berubise$B$,I8=`E:IU$5$l$k$H9,$;$K$J$k?M$,B?$$$H;W$$$^$9!#e(B

[email protected]|$be(Bupdatee$B$5$l$?$P$+$j$G$"$j!"$^[email protected]$l$F$k$H$O$$$$Fq$$$N$Ge(B
e$B$d$a$?$[$&$,$$$$$H;W$$$^$9!#e(B
eRubye$B<+BN!“e(Bwebe$B%”%W%j%1!<%7%g%s$G;H$&$K$O5!G=$,ITB-$7$F$$$k$N$G!"e(B
e$B$I$&$;I8=`E:IU$9$k$J$i$b$C$H6/NO$J%F%s%W%l!<%H%(%s%8%s$N$[$&$,e(B
e$B$$$$$h$&$K;W$$$^$9!#e(B

e$B$=$l$h$j$b!"e(Berb.rbe$B$r=q$-D>$7$?J}$,9,$;$K$J$k?M$O$h$jB?$$$N$G$O$J$$$G$7$g$&$+!#e(B
cgi.rbe$B$H0c$C$F!"e(Berb.rbe$B$O2~NI$9$l$P$^[email protected]$^[email protected]$$$1$k$H$$$&0u>]$r;}$C$F$$$^$9!#e(B

e$B7,ED$H$$$$$^$9!#e(B

2008/2/4 Yukihiro M. [email protected]:

e$B%Q%C%A$rMQ0U$7$F$/[email protected]$5$l$P<h$j9~$_$^$9!#e(B

CGI::Cookiee$B$r!"e(BDelegateClass(Array) e$B$r;H$o$J$$$h$&$Ke(B
e$B$9$k$?$a$Ne(Bpatch (for 1.8.6 p111) e$B$G$9!#e(B

Index: lib/cgi.rb

— lib/cgi.rb (revision 15382)
+++ lib/cgi.rb (working copy)
@@ -736,7 +736,6 @@
stdoutput.print(*options)
end

  • require “delegate”

    Class representing an HTTP cookie.

@@ -771,7 +770,7 @@

cookie1.domain = ‘domain’

cookie1.expires = Time.now + 30

cookie1.secure = true

  • class Cookie < DelegateClass(Array)
  • class Cookie

    Create a new CGI::Cookie object.

@@ -858,6 +857,36 @@
buf
end

  • ##–
  • define methods instead of DelegateClass(Array)

  • ##++
  • include Enumerable ##:nodoc:
  • def ##:nodoc:
  •  @value[*args]
    
  • end
  • def []=(index, value) ##:nodoc:
  •  @value[index] = value
    
  • end
  • def each(&block) ##:nodoc:
  •  @value.each(&block)
    
  • end
  • def method_missing(m, *args) ##:nodoc:
  •  @value.respond_to?(m) ? @value.__send__(m, *args) : super
    
  • end
  • def respond_to?(m) ##:nodoc:
  •  super(m) || @value.respond_to?(m)
    
  • end
  • #def inspect; @value.inspect; end
  • #def ==(arg); @value == arg; end
  • #def ===(arg); @value === arg; end
  • end # class Cookie

===================================================================

e$BB3$$$F0J2<$NLdBj$KBP$9$ke(Bpatch (for 1.8.6 p.111) e$B$G$9!#e(B
[ruby-list:44321] e$B$GEj9F$7$?$N$HF1$8$G$9$,:FAw$7$^$9!#e(B

  • multiparte$B;~$*$h$Se(BPOSTe$B%a%=%C%I;~$K<u?.$9$k%G!<%?$N%5%$%:$re(B
    e$B3NG’$7$F$$$J$$$?$a!“5pBg$J%G!<%?$rAw?.$5$l$k$H%5!<%P;q8;$,e(B
    e$B?)$$$D$V$5$l$k!#e(B
    e$B”*e(B
    Content-Lengthe$B$r%A%’%C%/$7!"D92a$.$l$PNc30$rH/@8$5$;$k!#e(B

  • multiparte$B;~$KG$0U$N?t$Ne(Bparametere$B$r<u$1IU$1$k$?$a!“e(B
    e$BNc$([email protected]$Ne(Bparametere$B$rAw?.$9$k$3$H$G!”%5!<%P$K$?$/$5$s$Ne(B
    Tempfilee$B%*%V%8%’%/%[email protected]@.$9$k$3$H$,$G$-$F$7$^$&!#e(B
    e$B"*e(B parametere$B$N?t$r%A%’%C%/$7!"B?$9$.$l$PNc30$rH/@8$5$;$k!#e(B

[email protected])8BCM$ODj?t$G;XDj$7$F$^$9$,!“I,MW$G$”$l$P%/%i%9JQ?t$de(B
e$B%$%s%9%?%s%9JQ?t$G;XDj$G$-$k$h$&$K$7$F$/[email protected]$5$$!#e(B

Index: lib/cgi.rb

— lib/cgi.rb (revision 15382)
+++ lib/cgi.rb (working copy)
@@ -907,6 +907,17 @@
params
end

  • Maximum content length of post data

  • MAX_CONTENT_LENGTH = 2 * 1024 * 1024
  • Maximum content length of multipart data

  • MAX_MULTIPART_LENGTH = 128 * 1024 * 1024
  • Maximum number of request parameters when multipart

  • MAX_MULTIPART_COUNT = 128
  • Mixin module. It provides the follow functionality groups:

    1. Access to CGI environment variables as methods. See

@@ -984,7 +995,11 @@
raise EOFError, “bad content body”
end

  •  count = MAX_MULTIPART_COUNT
     loop do
    
  •    unless (count -= 1) >= 0
    
  •      raise StandardError.new("too many parameters.")
    
  •    end
       head = nil
       if 10240 < content_length
         require "tempfile"
    

@@ -1106,7 +1121,11 @@
%r|\Amultipart/form-data.*boundary="?([^";,]+)"?|n.match(env_table[‘CONTENT_TYPE’])
boundary = $1.dup
@multipart = true

  •    @params = read_multipart(boundary,
    

Integer(env_table[‘CONTENT_LENGTH’]))

  •    content_length = Integer(env_table['CONTENT_LENGTH'])
    
  •    unless content_length <= MAX_MULTIPART_LENGTH
    
  •      raise StandardError.new("too large multipart data.")
    
  •    end
    
  •    @params = read_multipart(boundary, content_length)
     else
       @multipart = false
       @params = CGI::parse(
    

@@ -1119,7 +1138,11 @@
end
when “POST”
stdinput.binmode if defined? stdinput.binmode

stdinput.read(Integer(env_table[‘CONTENT_LENGTH’])) or ‘’

  •                  content_length = 
    

Integer(env_table[‘CONTENT_LENGTH’])

  •                  unless content_length <= MAX_CONTENT_LENGTH
    
  •                    raise StandardError.new("too large post data.")
    
  •                  end
    
  •                  stdinput.read(content_length) or ''
                   else
                     read_from_cmdline
                   end
    

===================================================================

e$B$^$?e(B cgi.rb
e$B$N%F%9%H%9%/%j%W%H$O!"e(BCGIAlte$B$K4^$^$l$F$$$^$9!#e(B
([ruby-list:44331]e$B$K=q$$$?DL$j$G$9!#!Ke(B
e$B%a!<%k$G$*Aw$j$9$k$K$OBg$-$9$.$k$H;W$&$N$G!"e(BCGIAlte$B$r%@%&%s%m!<%I$7$Fe(B
e$B$48!F$$/[email protected]$5$$!#e(B

cgi.rbe$B$N2~A1$K;[email protected]$O$"$^$j4X78$J$$$H;W$$$^$9$1$I!#e(B

e$B$^$D$b$H$5$s8D?M$KBP$7$F$G$O$J$/!":[email protected]$$NCf$NIwD,$KBP$7$F$Ne(B
e$B$D$b$j$G$7$?!#$45$J,$r32$5$l$?$N$G$7$?$i?=$7Lu$"$j$^$;$s!#e(B

e$B31$H$$$$$^$9!#e(B

On 2008/02/06, at 2:20, Makoto Kuwata wrote:

e$B$=$l$h$j$b!"e(Berb.rbe$B$r=q$-D>$7$?J}$,9,$;$K$J$k?M$O$h$je(B
e$BB?$$$N$G$O$J$$$G$7$g$&$+!#e(B
cgi.rbe$B$H0c$C$F!"e(Berb.rbe$B$O2~NI$9$l$P$^[email protected]$^[email protected]$$$1$k$H$$e(B
e$B$&0u>]$r;}$C$F$$$^$9!#e(B

e$B8=>u$GIT9,$J?M$,B?$$$H$$$&$3$H$G$9$M!#e(B
erb.rbe$B$K<j$r$$$l$k5$$K$J$C$F$-$^$7$?!#e(B

RubyKaigi 2007e$B$G$N9V1i$r;29M$K!"JQ49ItJ,$re(B
e$B$U$D$&$NB.EY$K$7$?$$$H;W$$$^$9!#e(B

Railse$B$N0lHLE*$J;H$$J}$G$O!"Kh2sJQ49$7$F$$$ke(B
e$B$N$+$7$i$s!#e(B

[email protected]$G$9!#e(B

At Wed, 6 Feb 2008 02:06:34 +0900,
Makoto Kuwata wrote in [ruby-dev:33606]:

CGI::Cookiee$B$r!"e(BDelegateClass(Array) e$B$r;H$o$J$$$h$&$Ke(B
e$B$9$k$?$a$Ne(Bpatch (for 1.8.6 p111) e$B$G$9!#e(B

1.9e$B$G$Oe(BDelegateClass(Array)e$B$O$+$J$j2~A1$7$?$H;W$$$^$9!#e(B

Tempfilee$B%*%V%8%’%/%[email protected]@.$9$k$3$H$,$G$-$F$7$^$&!#e(B
e$B"*e(B parametere$B$N?t$r%A%’%C%/$7!"B?$9$.$l$PNc30$rH/@8$5$;$k!#e(B

StandardErrore$B$r;H$C$F$$$^$9$,!"JL$N$[$&$,$$$$$s$8$c$J$$$G$7$g$&e(B
e$B$+!#e(BRangeError?

[email protected])8BCM$ODj?t$G;XDj$7$F$^$9$,!“I,MW$G$”$l$P%/%i%9JQ?t$de(B
e$B%$%s%9%?%s%9JQ?t$G;XDj$G$-$k$h$&$K$7$F$/[email protected]$5$$!#e(B

e$B8e<T$K$7$F$_$^$7$?!#e(B[ruby-dev:33606]e$B$+$i$N:9J,$K$7$h$&$+$H;W$$$^e(B
e$B$7$?$,!"%Q%C%A$,2u$l$F$$$k$h$&$J$N$Ge(Bsvn HEADe$B$+$i$N:9J,$G$9!#e(B

e$BB>$K!"e(BNEEDS_BINMODEe$B$NH=Dj>r7o$,e(Bdarwine$B$b4^$s$G$7$^[email protected]$d!"e(B
env_tablee$B$r;H$o$:$KD>@\e(BENVe$B$r;[email protected]$7$F$$$^$9!#e(B

At Mon, 4 Feb 2008 04:40:16 +0900,
Makoto Kuwata wrote in [ruby-dev:33580]:

(6) CGI#initialize() e$B$NCf$Ge(B ENV[‘QUERY_STRING’] e$B$de(B ENV[‘HTTP_COOKIE’] e$B$re(B
parse e$B$7$F$$$k$N$G!"e(BFastCGI e$B$N$h$&$Ke(B ENV e$B$r;H$o$J$$>l9g!"e(B
cgi.rb e$B$r;H$&$N$,:$Fqe(B
(e$B<B:]!“e(Bfcgi.rb e$B$G$Ne(B cgi.rb e$BBP:v$OHa;4$J%3!<%I$K$J$C$F$$$ke(B)
e$B”*e(B e$B2r7h:ve(B: workaround e$B$H$7$F!"e(B$ENV = ENV e$B$r$7$F$+$i!"e(B
CGI#initialize() e$B$G$Oe(B ENV e$B$N$+$o$j$Ke(B $ENV e$B$r;H$&$h$&$KJQ99e(B

e$B$3$l$K4X$7$F$O!“e(BCGIe$B$r7Q>5$7$?%/%i%9$Ge(Benv_tablee$B$r%*!<%P!<%i%$%I$9e(B
e$B$k$N$,@5$7$$$N$G$O$J$$$G$7$g$&$+!#$?$7$+$KO3$l$F$$$kItJ,$b$”$j$^e(B
e$B$7$?$,!"$=$NFs$D$K$D$$$F$O0JA0$+$ie(Benv_tablee$B$r;H$&$h$&$K$J$C$F$$e(B
e$B$^$9!#e(B

Index: lib/cgi.rb

— lib/cgi.rb (revision 15377)
+++ lib/cgi.rb (working copy)
@@ -287,5 +287,5 @@ class CGI
REVISION = ‘$Id$’ #:nodoc:

  • NEEDS_BINMODE = true if /WIN/ni.match(RUBY_PLATFORM)
  • NEEDS_BINMODE = true if /cygwin|mswin|bccwin/.match(RUBY_PLATFORM)

    Path separators in different environments.

@@ -737,5 +737,4 @@ class CGI
end

  • require “delegate”

    Class representing an HTTP cookie.

@@ -772,5 +771,5 @@ class CGI

cookie1.expires = Time.now + 30

cookie1.secure = true

  • class Cookie < DelegateClass(Array)
  • class Cookie

    Create a new CGI::Cookie object.

@@ -808,5 +807,5 @@ class CGI
@path = options[“path”]
else

  •    %r|^(.*/)|.match(ENV["SCRIPT_NAME"])
    
  •    %r|^(.*/)|.match(env_table["SCRIPT_NAME"])
       @path = ($1 or "")
     end
    

@@ -859,4 +858,34 @@ class CGI
end

  • ##–
  • define methods instead of DelegateClass(Array)

  • ##++
  • include Enumerable ##:nodoc:
  • def ##:nodoc:
  •  @value[*args]
    
  • end
  • def []=(index, value) ##:nodoc:
  •  @value[index] = value
    
  • end
  • def each(&block) ##:nodoc:
  •  @value.each(&block)
    
  • end
  • def method_missing(m, *args) ##:nodoc:
  •  @value.respond_to?(m) ? @value.__send__(m, *args) : super
    
  • end
  • def respond_to?(m) ##:nodoc:
  •  super(m) || @value.respond_to?(m)
    
  • end
  • #def inspect; @value.inspect; end
  • #def ==(arg); @value == arg; end
  • #def ===(arg); @value === arg; end
  • end # class Cookie

@@ -908,4 +937,17 @@ class CGI
end

  • Maximum content length of post data

  • MAX_CONTENT_LENGTH = 2 * 1024 * 1024
  • Maximum content length of multipart data

  • MAX_MULTIPART_LENGTH = 128 * 1024 * 1024
  • Maximum number of request parameters when multipart

  • MAX_MULTIPART_COUNT = 128
  • Maximum size to use StringIO

  • MAX_STRINGIO_SIZE = 10240
  • Mixin module. It provides the follow functionality groups:

@@ -985,7 +1027,11 @@ class CGI
end

  •  count = @max_multipart_count
     loop do
    
  •    unless (count -= 1) >= 0
    
  •      raise RangeError, "too many parameters"
    
  •    end
       head = nil
    
  •    if 10240 < content_length
    
  •    if content_length > @max_stringio_size
         require "tempfile"
         body = Tempfile.new("CGI")
    

@@ -1107,5 +1153,9 @@ class CGI
boundary = $1.dup
@multipart = true

  •    @params = read_multipart(boundary, 
    

Integer(env_table[‘CONTENT_LENGTH’]))

  •    content_length = Integer(env_table['CONTENT_LENGTH'])
    
  •    unless content_length <= @max_multipart_length
    
  •      raise RangeError, "too large multipart data"
    
  •    end
    
  •    @params = read_multipart(boundary, content_length)
     else
       @multipart = false
    

@@ -1120,5 +1170,9 @@ class CGI
when “POST”
stdinput.binmode if defined? stdinput.binmode

stdinput.read(Integer(env_table[‘CONTENT_LENGTH’])) or ‘’

  •                  content_length = 
    

Integer(env_table[‘CONTENT_LENGTH’])

  •                  unless content_length <= @max_content_length
    
  •                    raise RangeError, "too large post data"
    
  •                  end
    
  •                  stdinput.read(content_length) or ''
                   else
                     read_from_cmdline
    

@@ -2263,9 +2317,13 @@ class CGI

CGI locations, which varies according to the REQUEST_METHOD.

def initialize(type = “query”)

  • if defined?(MOD_RUBY) && !ENV.key?(“GATEWAY_INTERFACE”)
  • if defined?(MOD_RUBY) && !env_table.key?(“GATEWAY_INTERFACE”)
    Apache.request.setup_cgi_env
    end

    extend QueryExtension

  • @max_content_length ||= MAX_CONTENT_LENGTH

  • @max_multipart_length ||= MAX_MULTIPART_LENGTH

  • @max_multipart_count ||= MAX_MULTIPART_COUNT

  • @max_stringio_size ||= MAX_STRINGIO_SIZE
    @multipart = false
    if defined?(CGI_PARAMS)

e$B7,ED$G$9!#e(B

2008/2/4 Yukihiro M. [email protected]:

e$B8xJg$7$^$9!#e(B

e$B$3$l$C$F8x<0$JH/[email protected]$H$H$i$($F$$$$$s$G$9$h$M!#e(B
e$B4|8B$d>r7o$J$I$"$j$^$9$+!#e(B
(e$B$?$H$($Pe(B CGI e$B$G;H$&$N$G$J$k$Y$/7Z$$$b$N$r4uK>!"$H$+!#e(B)
e$B$"$He(B Matze$BF|5-$G%"%J%&%s%9$5$l$k$H!"B?$/$N?M$NL$K?($l$Fe(B
e$B$$$$$b$N$,=8$^$k$+$b$7$l$^$;$s!#e(B

e$B7,ED$H$$$$$^$9!#e(B
e$B$5$C$=$/$NBP1~!"$"$j$,$H$&$4$6$$$^$9!#e(B

2008/2/6 Nobuyoshi N. [email protected]:

1.9e$B$G$Oe(BDelegateClass(Array)e$B$O$+$J$j2~A1$7$?$H;W$$$^$9!#e(B

1.8 e$B7O$K$bH?1G$5$l$^$9$+!)e(B
e$B$b$7$=$&$J$i!"e(BDelegateClass(Array)
e$B$r<h$j=|$+$J$/$F$b$$$$$+$be(B
e$B$7$l$^$;$s!#e(B

StandardErrore$B$r;H$C$F$$$^$9$,!"JL$N$[$&$,$$$$$s$8$c$J$$$G$7$g$&e(B
e$B$+!#e(BRangeError?

e$B$J$k$[$I!#$=$&$$$&Nc30%/%i%9$,$"$k$s$G$9$M!#JY6/$K$J$j$^$9!#e(B

[email protected])8BCM$ODj?t$G;XDj$7$F$^$9$,!“I,MW$G$”$l$P%/%i%9JQ?t$de(B
e$B%$%s%9%?%s%9JQ?t$G;XDj$G$-$k$h$&$K$7$F$/[email protected]$5$$!#e(B

e$B8e<T$K$7$F$_$^$7$?!#e(B

cgi.rb [email protected][email protected]$H!"e(BCGI.new e$B$7$?$HF1;~$Ke(B HTTP Request
e$B$,%Q!<%9e(B
e$B$5$l$k$N$G!"8=>u$G$O%Q!<%9$9$kA0$Ke(B @max_content_length
e$B$H$+$re(B
[email protected]_Dj$9$k$3$H$,$G$-$^$;$s!#e(B
CGI#initialize() e$B$KBhe(B2e$B0z?te(B opts={} e$B$rDI2C$7$Fe(B

class CGI
def initialize(type=“query”, opts={})
@max_content_length = opts[:max_content_length]
@max_multipart_length = opts[:max_multipart_length]

e$B$H$9$k$+!“e(BCGI#initialize() e$B$G%Q!<%9$9$k$N$rM^@)$7$F$*$$$Fe(B
e$B$”$H$G9%$-$J%?%$%%s%0$G%Q!<%9$G$-$k$h$&$J;EAH$$,$J$$$H!“e(B
MAX_CONTENT_LENGTH e$B$re(B @max_content_length e$B$K$7$F$be(B
e$B$”$s$^$j$&$l$7$/$"$j$^$;$s!#e(B

e$B$?$V$s>e$N%3!<%I$N$h$&$K!"e(BCGI#initialize e$B$KBhe(B2e$B0z?te(B
opts={} e$B$re(B
e$BDI2C$7$F$b$i$&$N$,$$$A$P$s%9%^!<%[email protected]$H;W$$$^$9!#e(B

[ruby-dev:33606]e$B$+$i$N:9J,$K$7$h$&$+$H;W$$$^e(B
e$B$7$?$,!"%Q%C%A$,2u$l$F$$$k$h$&$J$N$Ge(Bsvn HEADe$B$+$i$N:9J,$G$9!#e(B

e$B?=$7Lu$"$j$^$;$s$G$7$?!#e(B
e$B%Q%C%A$O!"e(B1.8.6 p111 e$B$KBP$7$F:[email protected]$7$?$s$G$9$1$I!"e(BHEAD
e$B$KBP$7$Fe(B
e$B:[email protected]$9$k$b$N$J$s$G$7$g$&$+!#e(B
e$B:#8e$N$?$a$K$I$J$?$+65$([email protected]$1$^$9$+!#e(B

e$BB>$K!"e(BNEEDS_BINMODEe$B$NH=Dj>r7o$,e(Bdarwine$B$b4^$s$G$7$^[email protected]$d!"e(B

NEEDS_BINMODE e$B$C$FI,MW$J$N$G$7$g$&$+!#e(B
cgi.rb e$B$G$O!"@[email protected]$1$5$l$F!"$I$3$K$b;H$o$l$F$$$^$;$s!#e(B
PATH_SEPARATOR e$B$bF1MM$G$9!#e(B

env_tablee$B$r;H$o$:$KD>@\e(BENVe$B$r;[email protected]$7$F$$$^$9!#e(B

e$B$3$l$O$&$l$7$$$G$9$M!#8=>u$G$Oe(B CGI#env_table e$B$r3HD%$7$F$b!"e(B
e$B$[$H$s$I0UL#$,$J$+$C$?$N$G!#e(B

e$B$3$l$K4X$7$F$O!“e(BCGIe$B$r7Q>5$7$?%/%i%9$Ge(Benv_tablee$B$r%*!<%P!<%i%$%I$9e(B
e$B$k$N$,@5$7$$$N$G$O$J$$$G$7$g$&$+!#$?$7$+$KO3$l$F$$$kItJ,$b$”$j$^e(B
e$B$7$?$,!"$=$NFs$D$K$D$$$F$O0JA0$+$ie(Benv_tablee$B$r;H$&$h$&$K$J$C$F$$e(B
e$B$^$9!#e(B

CGI#env_table e$B$b!":#$N$^$^[email protected]$H;H$$$E$i$$$G$9!#e(B
e$B$?$H$($Pe(B CGI#env_table e$B$r<!$N$h$&$KJQ99$7$?$$$H$-!"e(B

class MyCGI < CGI
attr_accessor :env
def env_table
@env
end
end

e$B8=>[email protected]$He(B MyCGI.new e$B$7$?$H$-$K$O%Q!<%9$,=*$o$C$F$7$^$&$N$G!“e(B
@env [email protected]Dj$9$k%?%$%%s%0$,$”$j$^$;$s!#e(B
e$B$7$+$7!“A0=R$7$?$h$&$K$b$7e(B CGI#initialize() e$B$,e(B opts={}
e$B$re(B
e$B<h$k$J$i!”<!$N$h$&$K<+A3$K3HD%$G$-$^$9!#e(B

class MyCGI < CGI
def initialize(type=“query”, opts={})
@env = opts[:env] || ENV
super
end
attr_accessor :env
def env_table
@env
end
end

initialize() e$B$N;EMM$r;R%/%i%9$G<+M3$KJQ$($F$b$$$$$G$9$,!“e(B
e$B$G$-$l$Pe(B CGI e$B%/%i%9$N$[$&$Ge(B opts={}
e$B$N$h$&$J%5%]!<%H$,$”$k$H!"e(B
CGI e$B%/%i%9$r3HD%$7$?$$?M$K$O$&$l$7$$$H;W$$$^$9!#e(B
e$B$$$+$,$G$7$g$&$+!#e(B

[email protected]!"$3$l$O<B:]$Ke(B CGI e$B%/%i%9$r3HD%$7$F$$$kJ}$N0U8+$re(B
e$BJ9$$$F$_$?$$$G$9$M!#e(B
fcgi.rb e$B$N:n<T$5$s!"$I$&$G$7$g$&!)e(B

[email protected]$G$9!#e(B

At Wed, 6 Feb 2008 23:25:12 +0900,
Makoto Kuwata wrote in [ruby-dev:33618]:

1.9e$B$G$Oe(BDelegateClass(Array)e$B$O$+$J$j2~A1$7$?$H;W$$$^$9!#e(B

1.8 e$B7O$K$bH?1G$5$l$^$9$+!)e(B
e$B$b$7$=$&$J$i!"e(BDelegateClass(Array) e$B$r<h$j=|$+$J$/$F$b$$$$$+$be(B
e$B$7$l$^$;$s!#e(B

e$B;DG0$J$,$ie(B1.8e$B$G$O%V%m%C%/0z?t$r<u$1<h$k%V%m%C%/$rDj5A$G$-$J$$$?e(B
e$B$a!"IT2DG=$G$9!#e(B

[email protected])8BCM$ODj?t$G;XDj$7$F$^$9$,!“I,MW$G$”$l$P%/%i%9JQ?t$de(B
e$B%$%s%9%?%s%9JQ?t$G;XDj$G$-$k$h$&$K$7$F$/[email protected]$5$$!#e(B

e$B8e<T$K$7$F$_$^$7$?!#e(B

cgi.rb [email protected][email protected]$H!"e(BCGI.new e$B$7$?$HF1;~$Ke(B HTTP Request e$B$,%Q!<%9e(B
e$B$5$l$k$N$G!"8=>u$G$O%Q!<%9$9$kA0$Ke(B @max_content_length e$B$H$+$re(B
[email protected]_Dj$9$k$3$H$,$G$-$^$;$s!#e(B

e$B$H$j$"$($:!"e(BCGIe$B$r7Q>5$7$?%/%i%9$Ne(Binitializee$B$Ge(Bsupere$B$NA0$K%;%C%H$9e(B
e$B$k$3$H$G!"BP1~$G$-$k$O$:$G$9!#e(B

[ruby-dev:33606]e$B$+$i$N:9J,$K$7$h$&$+$H;W$$$^e(B
e$B$7$?$,!"%Q%C%A$,2u$l$F$$$k$h$&$J$N$Ge(Bsvn HEADe$B$+$i$N:9J,$G$9!#e(B

e$B?=$7Lu$"$j$^$;$s$G$7$?!#e(B
e$B%Q%C%A$O!"e(B1.8.6 p111 e$B$KBP$7$F:[email protected]$7$?$s$G$9$1$I!"e(BHEAD e$B$KBP$7$Fe(B
e$B:[email protected]$9$k$b$N$J$s$G$7$g$&$+!#e(B
e$B:#8e$N$?$a$K$I$J$?$+65$([email protected]$1$^$9$+!#e(B

e$B$3$N>l9ge(BHEADe$B$H$$$C$F$$$k$N$O!“e(B1.8e$B7ONs$N:G?7$H$$$&$3$H$G$9!#e(B
cgi.rbe$B$K$D$$$F$Oe(Bp111(e$B$H$$$&$+$=$l0JA0e(B)e$B$+$iJQ2=$,$J$$$N$G!”<B:]$Ke(B
e$B$O$I$A$i$G$bLdBj$"$j$^$;$s!#!V2u$l$F$$$k!W$H$$$&$N$O!"$=$l$H$OJLe(B
e$B$NOC$G!"e(BGMaile$B$G>!<[email protected]^$jJV$5$l$F$7$^$C$F$$$k$H$$$&$3$H$G$9!#e(B

e$BB>$K!"e(BNEEDS_BINMODEe$B$NH=Dj>r7o$,e(Bdarwine$B$b4^$s$G$7$^[email protected]$d!"e(B

NEEDS_BINMODE e$B$C$FI,MW$J$N$G$7$g$&$+!#e(B
cgi.rb e$B$G$O!"@[email protected]$1$5$l$F!"$I$3$K$b;H$o$l$F$$$^$;$s!#e(B
PATH_SEPARATOR e$B$bF1MM$G$9!#e(B

e$B>C$=$&$+$H$b;W$C$?$N$G$9$,!"$b$7$+$7$Fe(Bcgi.rbe$B$r;H$&B&$G;2>H$7$F$$e(B
e$B$?$j$9$k$N$+$J$H!#e(B

env_tablee$B$r;H$o$:$KD>@\e(BENVe$B$r;[email protected]$7$F$$$^$9!#e(B

e$B$3$l$O$&$l$7$$$G$9$M!#8=>u$G$Oe(B CGI#env_table e$B$r3HD%$7$F$b!"e(B
e$B$[$H$s$I0UL#$,$J$+$C$?$N$G!#e(B

e$B$7$+$7!";D$C$F$$$?$N$Oe(BSCRIPT_NAMEe$B$He([email protected]$1$G!"$=$le(B
e$B0J30$O$I$&$G$b$$$$$H$$$&$3$H$O$J$$$H;W$&$N$G$9$,!#e(B

def env_table
  @env
end

end

e$B8=>[email protected]$He(B MyCGI.new e$B$7$?$H$-$K$O%Q!<%9$,=*$o$C$F$7$^$&$N$G!“e(B
@env [email protected]Dj$9$k%?%$%%s%0$,$”$j$^$;$s!#e(B

e$B$=$b$=$b!"e(Binitializee$B$NCf$GA4ItJD$8$F$7$^$C$F$$$k$N$,$&$^$/$J$$$Ne(B
[email protected]$H;W$$$^$9!#e(B

e$B$7$+$7!“A0=R$7$?$h$&$K$b$7e(B CGI#initialize() e$B$,e(B opts={} e$B$re(B
e$B<h$k$J$i!”<!$N$h$&$K<+A3$K3HD%$G$-$^$9!#e(B

e$B$H$j$"$($:$N2sHr:v$H$7$F$O$=$l$G$$$$$s$8$c$J$$$G$7$g$&$+!#:#$^$Ge(B
e$B$Ne(Bcgi.rbe$B$G$b;H$($^$9$7!#e([email protected]_content_lengthe$B$G$bF1$8$3$H$G$9$h$M!#e(B

e$B$"$k$$$O!"e(Bdefine_methode$B$G>e=q$-$9$k$H$+!#e(B

my_env = {…}
cgi = Class.new(CGI) {define_method(:env_table){my_env}}.new

initialize() e$B$N;EMM$r;R%/%i%9$G<+M3$KJQ$($F$b$$$$$G$9$,!“e(B
e$B$G$-$l$Pe(B CGI e$B%/%i%9$N$[$&$Ge(B opts={} e$B$N$h$&$J%5%]!<%H$,$”$k$H!"e(B
CGI e$B%/%i%9$r3HD%$7$?$$?M$K$O$&$l$7$$$H;W$$$^$9!#e(B
e$B$$$+$,$G$7$g$&$+!#e(B

e$B$=$N$X$s$b4^$a$F:[email protected][email protected]$H;W$$$^$9!#e(B

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs