aboutsummaryrefslogtreecommitdiffstats
path: root/lib/cgi.rb
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-12-03 23:35:45 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-12-03 23:35:45 +0000
commit6b279c3d0941b72ead04ed660de0a8d3462a93c4 (patch)
treee67a76bd1656c2faf2c2afc5c7de22ddef133f8f /lib/cgi.rb
parent5ce38775ba8d9a5fc0386e80170c32416304c5ed (diff)
downloadruby-6b279c3d0941b72ead04ed660de0a8d3462a93c4.tar.gz
* lib/cgi.rb (CGI::QueryExtension::read_multipart): should quote
boundary. JVN#84798830 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/cgi.rb')
-rw-r--r--lib/cgi.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/cgi.rb b/lib/cgi.rb
index 8fc7061eca..440d3bef90 100644
--- a/lib/cgi.rb
+++ b/lib/cgi.rb
@@ -977,6 +977,7 @@ class CGI
def read_multipart(boundary, content_length)
params = Hash.new([])
boundary = "--" + boundary
+ quoted_boundary = Regexp.quote(boundary, "n")
buf = ""
bufsize = 10 * 1024
boundary_end=""
@@ -996,7 +997,7 @@ class CGI
head = nil
body = MorphingBody.new
- until head and /#{boundary}(?:#{EOL}|--)/n.match(buf)
+ until head and /#{quoted_boundary}(?:#{EOL}|--)/n.match(buf)
if (not head) and /#{EOL}#{EOL}/n.match(buf)
buf = buf.sub(/\A((?:.|\n)*?#{EOL})#{EOL}/n) do
head = $1.dup
@@ -1022,7 +1023,7 @@ class CGI
content_length -= c.size
end
- buf = buf.sub(/\A((?:.|\n)*?)(?:[\r\n]{1,2})?#{boundary}([\r\n]{1,2}|--)/n) do
+ buf = buf.sub(/\A((?:.|\n)*?)(?:[\r\n]{1,2})?#{quoted_boundary}([\r\n]{1,2}|--)/n) do
body.print $1
if "--" == $2
content_length = -1