summaryrefslogtreecommitdiff
path: root/lib/webrick/httputils.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/webrick/httputils.rb')
-rw-r--r--lib/webrick/httputils.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/webrick/httputils.rb b/lib/webrick/httputils.rb
index 18e3e258876..e45d8e04997 100644
--- a/lib/webrick/httputils.rb
+++ b/lib/webrick/httputils.rb
@@ -179,14 +179,14 @@ module WEBrick
if value
parts = value.split(/,\s*/)
parts.each {|part|
- if m = %r{^([^\s,]+?)(?:;\s*q=([\d]+(?:\.[\d]+)))?$}.match(part)
- lang = m[1]
+ if m = %r{^([^\s,]+?)(?:;\s*q=(\d+(?:\.\d+)?))?$}.match(part)
+ val = m[1]
q = (m[2] or 1).to_f
- tmp.push([lang, q])
+ tmp.push([val, q])
end
}
- tmp = tmp.sort_by{|lang, q| -q}
- tmp.collect!{|lang, q| lang}
+ tmp = tmp.sort_by{|val, q| -q}
+ tmp.collect!{|val, q| val}
end
return tmp
end