summary refs log tree commit
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2015-06-15 23:31:46 -0500
committerMatthew Draper <matthew@trebex.net>2015-07-18 15:18:42 +0930
commit2e244dd784c1e1a831eb2103fe55b6590c4ae003 (patch)
treee60ca67087220936347f6c4ea6342facb053df8b
parent4453f50aa0d36f0fca08a19d75270c7fb28d2b74 (diff)
downloadrack-2e244dd784c1e1a831eb2103fe55b6590c4ae003.tar.gz
Omit unnecessary ?s in EXTENDED_INITIAL_VALUE
The ? outside the groups is redundant and Ruby's regular expression engine
rightfully produces a warning when compiling the regular expression.

Removing the ?s prevents the warning from being printed to stderr.

See also: http://rubular.com/r/J4CWeIHQTK
-rw-r--r--lib/rack/multipart.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/rack/multipart.rb b/lib/rack/multipart.rb
index 79f6d993..9417120a 100644
--- a/lib/rack/multipart.rb
+++ b/lib/rack/multipart.rb
@@ -24,11 +24,11 @@ module Rack
     SECTION = /\*0|\*\d+/
     REGULAR_PARAMETER_NAME = /#{ATTRIBUTE}#{SECTION}?/
     REGULAR_PARAMETER = /(#{REGULAR_PARAMETER_NAME})=(#{VALUE})/
-    EXTENDED_OTHER_NAME = /#{ATTRIBUTE}\*[1-9]\d+\*/
+    EXTENDED_OTHER_NAME = /#{ATTRIBUTE}\*[1-9][0-9]+\*/
     EXTENDED_OTHER_VALUE = /%[0-9a-fA-F]{2}|#{ATTRIBUTE_CHAR}/
     EXTENDED_OTHER_PARAMETER = /#{EXTENDED_OTHER_NAME}=#{EXTENDED_OTHER_VALUE}/
     EXTENDED_INITIAL_NAME = /#{ATTRIBUTE}(?:\*0)?\*/
-    EXTENDED_INITIAL_VALUE = /(?:[a-zA-Z0-9\-]+)?'(?:[a-zA-Z0-9\-]+)?'(?:#{EXTENDED_OTHER_VALUE}+)/
+    EXTENDED_INITIAL_VALUE = /(?:[a-zA-Z0-9\-]+)'(?:[a-zA-Z0-9\-]+)'(?:#{EXTENDED_OTHER_VALUE}+)/
     EXTENDED_INITIAL_PARAMETER = /#{EXTENDED_INITIAL_NAME}=#{EXTENDED_INITIAL_VALUE}/
     EXTENDED_PARAMETER = /#{EXTENDED_INITIAL_PARAMETER}|#{EXTENDED_OTHER_PARAMETER}/
     DISPPARM = /;\s*#{REGULAR_PARAMETER}|#{EXTENDED_PARAMETER}/