From 0f7e301fe12cdab3084a9a9e8c46113f327b9332 Mon Sep 17 00:00:00 2001 From: naruse Date: Tue, 23 Dec 2014 18:10:19 +0000 Subject: [PATCH] * lib/net/http/response.rb (Net::HTTPResponse): require one or more spaces [Bug #10591]. by leriksen https://github.com/ruby/ruby/pull/782 fix GH-782 NOTE: graph.facebook.com returns without SP Reason-Phrase. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++ lib/net/http/response.rb | 2 +- test/net/http/test_httpresponse.rb | 59 ++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9d66274f22..3e165101dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Wed Dec 24 02:44:06 2014 NARUSE, Yui + + * lib/net/http/response.rb (Net::HTTPResponse): require one or more + spaces [Bug #10591]. + by leriksen + https://github.com/ruby/ruby/pull/782 fix GH-782 + NOTE: graph.facebook.com returns without SP Reason-Phrase. + Wed Dec 24 02:12:22 2014 Nobuyoshi Nakada * tool/make-snapshot (package): VCS#branch_list expects glob a diff --git a/lib/net/http/response.rb b/lib/net/http/response.rb index 777aca9e45..b0731694ca 100644 --- a/lib/net/http/response.rb +++ b/lib/net/http/response.rb @@ -37,7 +37,7 @@ class Net::HTTPResponse def read_status_line(sock) str = sock.readline - m = /\AHTTP(?:\/(\d+\.\d+))?\s+(\d\d\d)\s*(.*)\z/in.match(str) or + m = /\AHTTP(?:\/(\d+\.\d+))?\s+(\d\d\d)(?:\s+(.*))?\z/in.match(str) or raise Net::HTTPBadResponse, "wrong status line: #{str.dump}" m.captures end diff --git a/test/net/http/test_httpresponse.rb b/test/net/http/test_httpresponse.rb index 974f8296cc..0193a153e4 100644 --- a/test/net/http/test_httpresponse.rb +++ b/test/net/http/test_httpresponse.rb @@ -244,6 +244,65 @@ EOS refute_same uri, response.uri end + def test_ensure_zero_space_does_not_regress + io = dummy_io(<