summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-04 05:18:09 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-04 05:18:09 +0000
commit644f96e978d42561bfd0ec4c9a4292b5f86946e6 (patch)
tree490e311cd24a432d4b2b3bd80ddd0dd17849b0f4
parentebf91e5115919770affa4bb43357bdb06c3e3e89 (diff)
downloadruby-644f96e978d42561bfd0ec4c9a4292b5f86946e6.tar.gz
ruby-644f96e978d42561bfd0ec4c9a4292b5f86946e6.tar.xz
ruby-644f96e978d42561bfd0ec4c9a4292b5f86946e6.zip
merge revision(s) 18220:
* lib/webrick/httputils.rb (WEBrick::HTTPUtils#split_header_value): reduce backtrack. based on a fix by Christian Neukirchen <chneukirchen AT gmail.com>. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_6@18347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--lib/webrick/httputils.rb16
-rw-r--r--version.h2
3 files changed, 11 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 564b3ec39..a490af214 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Mon Aug 4 14:15:58 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/webrick/httputils.rb (WEBrick::HTTPUtils#split_header_value):
+ reduce backtrack. based on a fix by Christian Neukirchen
+ <chneukirchen AT gmail.com>.
+
Mon Aug 4 14:10:01 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* regex.c (xmalloc, xrealloc, xfree): not to use ruby managed memory.
diff --git a/lib/webrick/httputils.rb b/lib/webrick/httputils.rb
index c57af2c86..976d3e915 100644
--- a/lib/webrick/httputils.rb
+++ b/lib/webrick/httputils.rb
@@ -23,16 +23,8 @@ module WEBrick
ret = path.dup
ret.gsub!(%r{/+}o, '/') # // => /
- while ret.sub!(%r{/\.(/|\Z)}o, '/'); end # /. => /
- begin # /foo/.. => /foo
- match = ret.sub!(%r{/([^/]+)/\.\.(/|\Z)}o){
- if $1 == ".."
- raise "abnormal path `#{path}'"
- else
- "/"
- end
- }
- end while match
+ while ret.sub!(%r'/\.(?:/|\Z)', '/'); end # /. => /
+ while ret.sub!(%r'/(?!\.\./)[^/]+/\.\.(?:/|\Z)', '/'); end # /foo/.. => /foo
raise "abnormal path `#{path}'" if %r{/\.\.(/|\Z)} =~ ret
ret
@@ -154,8 +146,8 @@ module WEBrick
module_function :parse_header
def split_header_value(str)
- str.scan(/((?:"(?:\\.|[^"])+?"|[^",]+)+)
- (?:,\s*|\Z)/xn).collect{|v| v[0] }
+ str.scan(%r'\G((?:"(?:\\.|[^"])+?"|[^",]+)+)
+ (?:,\s*|\Z)'xn).flatten
end
module_function :split_header_value
diff --git a/version.h b/version.h
index 1322029d7..b74c53468 100644
--- a/version.h
+++ b/version.h
@@ -2,7 +2,7 @@
#define RUBY_RELEASE_DATE "2008-08-04"
#define RUBY_VERSION_CODE 186
#define RUBY_RELEASE_CODE 20080804
-#define RUBY_PATCHLEVEL 284
+#define RUBY_PATCHLEVEL 285
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8