Webrick and String#each

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

1.9 e$B$K$Fe(B webrick e$B$Ke(B String#each
e$B:o=|$N1F6A$,$G$F$$$^$9!#e(B

raw e$B$Ke(B Array e$B$,Mh$F$7$^$C$?$j!“e(Bio e$B$Ke(B String
e$B$,Mh$F$7$^$&%1!<%9$,e(B
e$B$”$k$3$H<+BN$,$=$b$=$b$NLdBj$J5$$O$7$^$9$1$l$I!#e(B

e$B$J$*;29M$^$G$K!“e(BContent-Disposition e$B$,$”$k;~$Ke(B raw e$B$,e(B
Array e$B$K$J$j$^$9!#e(B

Index: lib/webrick/httputils.rb

RCS file: /src/ruby/lib/webrick/httputils.rb,v
retrieving revision 1.14
diff -u -r1.14 httputils.rb
— lib/webrick/httputils.rb 2 Nov 2006 00:21:27 -0000 1.14
+++ lib/webrick/httputils.rb 23 Nov 2006 08:18:40 -0000
@@ -127,7 +127,7 @@
def parse_header(raw)
header = Hash.new([].freeze)
field = nil

  •  raw.lines.each{|line|
    
  •  (raw.class.method_defined?(:lines) ? raw.lines : raw).each{|line|
       case line
       when /^([A-Za-z0-9!\#$%&'*+\-.^_`|~]+):\s*(.*?)\s*\z/om
         field, value = $1, $2
    

@@ -317,7 +317,7 @@
form_data = Hash.new
return form_data unless io
data = nil

  •  io.each{|line|
    
  •  (io.class.method_defined?(:lines) ? io.lines : io).each{|line|
       if boundary_regexp =~ line
         if data
           data.chop!

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

In message “Re: [ruby-dev:29931] webrick and String#each”
on Fri, 24 Nov 2006 11:33:22 +0900, “NARUSE, Yui”
[email protected] writes:

|1.9 e$B$K$Fe(B webrick e$B$Ke(B String#each e$B:o=|$N1F6A$,$G$F$$$^$9!#e(B
|
|raw e$B$Ke(B Array e$B$,Mh$F$7$^$C$?$j!“e(Bio e$B$Ke(B String e$B$,Mh$F$7$^$&%1!<%9$,e(B
|e$B$”$k$3$H<+BN$,$=$b$=$b$NLdBj$J5$$O$7$^$9$1$l$I!#e(B
|
|e$B$J$*;29M$^$G$K!“e(BContent-Disposition e$B$,$”$k;~$Ke(B raw e$B$,e(B Array e$B$K$J$j$^$9!#e(B

e$B$(!<$H!"$3$l$O8F$S=P$7B&$GBP=h$7$?$$$G$9!#e(B

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

In message “Re: [ruby-dev:29931] webrick and String#each”
on Fri, 24 Nov 2006 11:33:22 +0900, “NARUSE, Yui”
[email protected] writes:

|raw e$B$Ke(B Array e$B$,Mh$F$7$^$C$?$j!“e(Bio e$B$Ke(B String e$B$,Mh$F$7$^$&%1!<%9$,e(B
|e$B$”$k$3$H<+BN$,$=$b$=$b$NLdBj$J5$$O$7$^$9$1$l$I!#e(B

e$B%3!<%I$r8+$k$+$.$je(Bparse_form_datae$B$KEO$5$l$ke(Bio(body)e$B$OI,$:e(B
String e$B$N$h$&$J5$$,$7$^$9!#e(BTempfilee$B$,Mh$k$3$H$rA[Dj$7$F$$$?e(B
e$B$N$+$J$"!#e(B

e$BF0E*[email protected]$O$3$&$$$&$N$K<e$$!#e(B

e$B$o$?$J$Y$G$9!#e(B

“NARUSE, Yui” [email protected] writes:

retrieving revision 1.14
when /^([A-Za-z0-9!#$%&’+-.^_`|~]+):\s(.?)\s\z/om
field, value = $1, $2
@@ -317,7 +317,7 @@
form_data = Hash.new
return form_data unless io
data = nil

  •  io.each{|line|
    
  •  (io.class.method_defined?(:lines) ? io.lines : io).each{|line|
       if boundary_regexp =~ line
         if data
           data.chop!
    

IOe$B$de(BStringe$B$de(BStringIOe$B$K$O$=$N$?$a$Ne(Beach_linee$B$,$"$k$N$G!"e(B
e$B$3$3$G$O$=$l$r;H$C$?$[$&$,$$$$$G$7$g$&!#e(B
1.8e$B$G$be(B1.9e$B$G$b;H$($^$9$7!#e(B

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

e$B$?$FB3$1$G$9$,!#e(B

In message “Re: [ruby-dev:29931] webrick and String#each”
on Fri, 24 Nov 2006 11:33:22 +0900, “NARUSE, Yui”
[email protected] writes:

|1.9 e$B$K$Fe(B webrick e$B$Ke(B String#each e$B:o=|$N1F6A$,$G$F$$$^$9!#e(B
|
|raw e$B$Ke(B Array e$B$,Mh$F$7$^$C$?$j!“e(Bio e$B$Ke(B String e$B$,Mh$F$7$^$&%1!<%9$,e(B
|e$B$”$k$3$H<+BN$,$=$b$=$b$NLdBj$J5$$O$7$^$9$1$l$I!#e(B
|
|e$B$J$*;29M$^$G$K!“e(BContent-Disposition e$B$,$”$k;~$Ke(B raw e$B$,e(B Array e$B$K$J$j$^$9!#e(B

e$B;d$Oe(BWebricke$B$K6/$/$J$$$s$G3N>Z$O$J$$$s$G$9$,!"0J2<$N%3!<%I$Ge(B
e$BLdBj$O2r7h$7$^$9$+!)e(B

diff --git a/ChangeLog b/ChangeLog
index 65468be…13d051c 100644
— a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Fri Nov 24 15:57:25 2006 Yukihiro M. [email protected]
+

    • lib/webrick/httputils.rb (WEBrick::HTTPUtils::FormData::<<):
  • HTTPUtils::parse_header() takes a string.  [ruby-dev:29931]
    
    • lib/webrick/httputils.rb (WEBrick::HTTPUtils::parse_form_data):
  • String does no longer have each method.
    

Thu Nov 23 10:38:40 2006 Yukihiro M. [email protected]

* eval.c (rb_mod_define_method): set implicit visibility only when

diff --git a/lib/webrick/httputils.rb b/lib/webrick/httputils.rb
index 38a42b9…c853c96 100644
— a/lib/webrick/httputils.rb
+++ b/lib/webrick/httputils.rb
@@ -244,7 +244,7 @@ module WEBrick
if @header
super
elsif str == CRLF

  •      @header = HTTPUtils::parse_header(@raw_header)
    
  •      @header = HTTPUtils::parse_header(@raw_header.join)
         if cd = self['content-disposition']
           if /\s+name="(.*?)"/ =~ cd then @name = $1 end
           if /\s+filename="(.*?)"/ =~ cd then @filename = $1 end
    

@@ -317,7 +317,7 @@ module WEBrick
form_data = Hash.new
return form_data unless io
data = nil

  •  io.each{|line|
    
  •  io.lines.each{|line|
       if boundary_regexp =~ line
         if data
           data.chop!

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

e$B$=$N%Q%C%A$G<j85$G;n$7$?8B$j$G$OLdBj$J$/F0$-$^$7$?!#e(B

e$B$J$!"$o$?$J$Y$5$s$N$$C$7$c$k$H$*$j!“e(B
2e$B2U=j$”$ke(B lines.each e$B$re(B each_line e$B$K$7$F$bF0$-$^$7$?!#e(B
e$B$3$A$i$NJ}$,$$$$$+$b$7$l$^$;$s$M!#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