File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -157,13 +157,13 @@ def parse_header(raw)
157157 field = nil
158158 raw . each_line { |line |
159159 case line
160- when /^([A-Za-z0-9!\# $%&'*+\- .^_`|~]+):\s * (.*?)\s * \z /om
161- field , value = $1, $2
160+ when /^([A-Za-z0-9!\# $%&'*+\- .^_`|~]+):(.*?)\z /om
161+ field , value = $1, $2. strip
162162 field . downcase!
163163 header [ field ] = [ ] unless header . has_key? ( field )
164164 header [ field ] << value
165- when /^\s +(.*?)\s * \z /om
166- value = $1
165+ when /^\s +(.*?)/om
166+ value = line . strip
167167 unless field
168168 raise HTTPStatus ::BadRequest , "bad header '#{ line } '."
169169 end
@@ -183,7 +183,7 @@ def parse_header(raw)
183183 # Splits a header value +str+ according to HTTP specification.
184184
185185 def split_header_value ( str )
186- str . scan ( %r'\G ((?:"(?:\\ .|[^"])+?"|[^",]+)+)
186+ str . scan ( %r'\G ((?:"(?:\\ .|[^"])+?"|[^",]++ )+)
187187 (?:,\s *|\Z )'xn ) . flatten
188188 end
189189 module_function :split_header_value
You can’t perform that action at this time.
0 commit comments