diff options
author | Nobuyoshi Nakada <[email protected]> | 2019-08-13 12:14:28 +0900 |
---|---|---|
committer | Yusuke Endoh <[email protected]> | 2019-10-01 19:19:56 +0900 |
commit | 36e057e26ef2104bc2349799d6c52d22bb1c7d03 () | |
tree | 7a0a8c2fab0ee0417b21758a5287c67ff50d0974 /lib/webrick | |
parent | a0a2640b398cffd351f87d3f6243103add66575b (diff) |
Loop with String#scan without creating substrings
Create the substrings necessary parts only, instead of cutting the rest of the buffer. Also removed a useless, probable typo, regexp.
-rw-r--r-- | lib/webrick/httpauth/digestauth.rb | 19 |
1 files changed, 2 insertions, 17 deletions
@@ -290,23 +290,8 @@ module WEBrick def split_param_value(string) ret = {} - while string.bytesize != 0 - case string - when /^\s*([\w\-\.\*\%\!]+)=\s*\"((\\.|[^\"])*)\"\s*,?/ - key = $1 - matched = $2 - string = $' - ret[key] = matched.gsub(/\\(.)/, "\\1") - when /^\s*([\w\-\.\*\%\!]+)=\s*([^,\"]*),?/ - key = $1 - matched = $2 - string = $' - ret[key] = matched.clone - when /^s*^,/ - string = $' - else - break - end end ret end |