diff options
-rw-r--r-- | lib/webrick/httpresponse.rb | 2 | ||||
-rw-r--r-- | test/webrick/test_httpresponse.rb | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/webrick/httpresponse.rb b/lib/webrick/httpresponse.rb index 41a2510e6f..f206a05ce9 100644 --- a/lib/webrick/httpresponse.rb +++ b/lib/webrick/httpresponse.rb @@ -119,7 +119,7 @@ module WEBrick # The response's HTTP status line def status_line - "HTTP/#@http_version #@status #@reason_phrase #{CRLF}" + "HTTP/#@http_version #@status #@reason_phrase".rstrip << CRLF end ## diff --git a/test/webrick/test_httpresponse.rb b/test/webrick/test_httpresponse.rb index 468c60582d..a1d7712be0 100644 --- a/test/webrick/test_httpresponse.rb +++ b/test/webrick/test_httpresponse.rb @@ -222,5 +222,12 @@ module WEBrick assert_match(/#{@res.reason_phrase}/, body) assert_match(/#{message}/, body) end + + def test_no_extraneous_space + [200, 300, 400, 500].each do |status| + @res.status = status + assert_match(/\S\r\n/, @res.status_line) + end + end end end |