Skip to content

Commit

Permalink
Support empty reason phrases in the HTTP status line (#292)
Browse files Browse the repository at this point in the history
The reason phrase may be empty, see RFC 7230 section 3.1.2
  • Loading branch information
mkauf authored and taf2 committed Apr 10, 2016
1 parent 4234d4a commit 8f60aa9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/curl/easy.rb
Expand Up @@ -20,7 +20,7 @@ def initialize(code, msg)
#
def status
# Matches the last HTTP Status - following the HTTP protocol specification 'Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF'
statuses = self.header_str.scan(/HTTP\/\d\.\d\s(\d+\s.+)\r\n/).map{ |match| match[0] }
statuses = self.header_str.scan(/HTTP\/\d\.\d\s(\d+\s.*)\r\n/).map{ |match| match[0] }
statuses.last.strip
end

Expand Down

0 comments on commit 8f60aa9

Please sign in to comment.