diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-11-18 07:21:12 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-11-18 07:21:12 +0000 |
| commit | c49e73e6900934e7890defeb1ff249961ddd7ef1 (patch) | |
| tree | df8a75a95ff1e5f4f54fb6503a709033601bbb7d | |
| parent | abe48d7a4ae5b446c1c253a3fb04ac36d3357fd5 (diff) | |
* lib/webrick/httprequest.rb (WEBrick::HTTPRequest#read_request_line):
use non-greedy match for path retrieval to avoid huge recursion
for insanely long path.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@20246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 6 | ||||
| -rw-r--r-- | lib/webrick/httprequest.rb | 2 |
2 files changed, 7 insertions, 1 deletions
@@ -3,6 +3,12 @@ Tue Nov 18 16:18:23 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> * lib/logger.rb (ProgName): fixed for svn, based on a patch from Nobuhiro IMAI at [ruby-dev:37108]. +Tue Nov 18 15:59:37 2008 Yukihiro Matsumoto <matz@ruby-lang.org> + + * lib/webrick/httprequest.rb (WEBrick::HTTPRequest#read_request_line): + use non-greedy match for path retrieval to avoid huge recursion + for insanely long path. + Tue Nov 18 09:42:11 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> * lib/optparse.rb (OptionParser::make_switch): makes default diff --git a/lib/webrick/httprequest.rb b/lib/webrick/httprequest.rb index 1d32293a27..4021259072 100644 --- a/lib/webrick/httprequest.rb +++ b/lib/webrick/httprequest.rb @@ -225,7 +225,7 @@ module WEBrick @request_line = read_line(socket) if socket @request_time = Time.now raise HTTPStatus::EOFError unless @request_line - if /^(\S+)\s+(\S+)(?:\s+HTTP\/(\d+\.\d+))?\r?\n/mo =~ @request_line + if /^(\S+)\s+(\S+?)(?:\s+HTTP\/(\d+\.\d+))?\r?\n/mo =~ @request_line @request_method = $1 @unparsed_uri = $2 @http_version = HTTPVersion.new($3 ? $3 : "0.9") |
