From 5a0aa734b33e7107dcca48fb75c162d7bae16cd7 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Sat, 7 Jun 2008 20:08:13 +0000 Subject: merge revision(s) 14153: * lib/cgi.rb (read_multipart): exclude blanks from header values. [ruby-list:44327] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_5@16976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/cgi.rb | 10 +++++----- version.h | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d5fef3cb2..0c17e5cd83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Jun 8 05:05:05 2008 Nobuyoshi Nakada + + * lib/cgi.rb (read_multipart): exclude blanks from header values. + [ruby-list:44327] + Sun Jun 8 05:00:44 2008 Nobuyoshi Nakada * bignum.c (rb_cstr_to_inum): trailing spaces may exist at sqeezing diff --git a/lib/cgi.rb b/lib/cgi.rb index a5f79b14ac..c07f412442 100644 --- a/lib/cgi.rb +++ b/lib/cgi.rb @@ -1032,21 +1032,21 @@ 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) - filename = ($1 or "") + /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 (not /MSIE/ni.match(env_table['HTTP_USER_AGENT'])) 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 @@ -1055,7 +1055,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) diff --git a/version.h b/version.h index 9c0fb14535..e2b943e381 100644 --- a/version.h +++ b/version.h @@ -2,7 +2,7 @@ #define RUBY_RELEASE_DATE "2008-06-08" #define RUBY_VERSION_CODE 185 #define RUBY_RELEASE_CODE 20080608 -#define RUBY_PATCHLEVEL 156 +#define RUBY_PATCHLEVEL 157 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 -- cgit v1.2.3