aboutsummaryrefslogtreecommitdiffstats
path: root/lib/cgi.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-09 03:39:04 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-09 03:39:04 +0000
commit78cc1c45ee1dac3f32fccb6f0cd8739403d7568c (patch)
treefd1a9e710b66ca9d5022af6375423d7e74386906 /lib/cgi.rb
parent54f236542d7a1cb28e7902a987ca583b5eefe874 (diff)
downloadruby-78cc1c45ee1dac3f32fccb6f0cd8739403d7568c.tar.gz
* lib/cgi.rb (read_multipart): exclude blanks from header values.
[ruby-list:44327] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/cgi.rb')
-rw-r--r--lib/cgi.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/cgi.rb b/lib/cgi.rb
index 0a108df100..fad6d3f468 100644
--- a/lib/cgi.rb
+++ b/lib/cgi.rb
@@ -978,7 +978,7 @@ class CGI
def read_multipart(boundary, content_length)
params = Hash.new([])
boundary = "--" + boundary
- quoted_boundary = Regexp.quote(boundary, "n")
+ quoted_boundary = Regexp.quote(boundary)
buf = ""
bufsize = 10 * 1024
boundary_end=""
@@ -1029,13 +1029,13 @@ class CGI
if "--" == $2
content_length = -1
end
- boundary_end = $2.dup
+ boundary_end = $2.dup
""
end
body.rewind
- /Content-Disposition:.* filename=(?:"((?:\\.|[^\"])*)"|([^;]*))/ni.match(head)
+ /Content-Disposition:.* filename=(?:"((?:\\.|[^\"\s])*)"|([^;\s]*))/ni.match(head)
filename = ($1 or $2 or "")
if /Mac/ni.match(env_table['HTTP_USER_AGENT']) and
/Mozilla/ni.match(env_table['HTTP_USER_AGENT']) and
@@ -1043,7 +1043,7 @@ class CGI
filename = CGI::unescape(filename)
end
- /Content-Type: (.*)/ni.match(head)
+ /Content-Type: ([^\s]*)/ni.match(head)
content_type = ($1 or "")
(class << body; self; end).class_eval do
@@ -1052,7 +1052,7 @@ class CGI
define_method(:content_type) {content_type.dup.taint}
end
- /Content-Disposition:.* name="?([^\";]*)"?/ni.match(head)
+ /Content-Disposition:.* name="?([^\";\s]*)"?/ni.match(head)
name = ($1 || "").dup
if params.has_key?(name)