ruby / ruby/webrick

test_httpresponse.rb test failures

Open
#112 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
327
Forks
112
Avg merge
4h 2m
Merged PRs (30d)
1

Description

Hi,

Testing the latest release (1.8.1) with Ruby 2.7.4, I see the following test failures:

F
==========================================================================================================
     71:       io.rewind
     72:       res = Net::HTTPResponse.read_new(Net::BufferedIO.new(io))
     73:       assert_equal '500', res.code
  => 74:       refute_match 'cracked_indicator_for_test', io.string
     75:     end
     76: 
     77:     def test_prevent_response_splitting_headers_lf
/tmp/guix-build-ruby-webrick-1.8.1.drv-1/source/test/webrick/test_httpresponse.rb:74:in `test_prevent_response_splitting_cookie_headers_cr'
Failure: test_prevent_response_splitting_cookie_headers_cr(WEBrick::TestHTTPResponse):
  <REGEXP> in assert_not_match(<REGEXP>, ...) should be a Regexp.
  <"cracked_indicator_for_test"> was expected to be instance_of?
  <Regexp> but was
  <String>.
==========================================================================================================
/tmp/guix-build-ruby-webrick-1.8.1.drv-1/source/lib/webrick/httpresponse.rb:260: warning: instance variable @upgrade not initialized
F
==========================================================================================================
     50:       io.rewind
     51:       res = Net::HTTPResponse.read_new(Net::BufferedIO.new(io))
     52:       assert_equal '500', res.code
  => 53:       refute_match 'cracked_indicator_for_test', io.string
     54:     end
     55: 
     56:     def test_prevent_response_splitting_headers_cr
/tmp/guix-build-ruby-webrick-1.8.1.drv-1/source/test/webrick/test_httpresponse.rb:53:in `test_prevent_response_splitting_cookie_headers_crlf'
Failure: test_prevent_response_splitting_cookie_headers_crlf(WEBrick::TestHTTPResponse):
  <REGEXP> in assert_not_match(<REGEXP>, ...) should be a Regexp.
  <"cracked_indicator_for_test"> was expected to be instance_of?
  <Regexp> but was
  <String>.
==========================================================================================================
/tmp/guix-build-ruby-webrick-1.8.1.drv-1/source/lib/webrick/httpresponse.rb:260: warning: instance variable @upgrade not initialized
F
==========================================================================================================
     92:       io.rewind
     93:       res = Net::HTTPResponse.read_new(Net::BufferedIO.new(io))
     94:       assert_equal '500', res.code
  => 95:       refute_match 'cracked_indicator_for_test', io.string
     96:     end
     97: 
     98:     def test_set_redirect_response_splitting
/tmp/guix-build-ruby-webrick-1.8.1.drv-1/source/test/webrick/test_httpresponse.rb:95:in `test_prevent_response_splitting_cookie_headers_lf'
Failure: test_prevent_response_splitting_cookie_headers_lf(WEBrick::TestHTTPResponse):
  <REGEXP> in assert_not_match(<REGEXP>, ...) should be a Regexp.
  <"cracked_indicator_for_test"> was expected to be instance_of?
  <Regexp> but was
  <String>.
==========================================================================================================
/tmp/guix-build-ruby-webrick-1.8.1.drv-1/source/lib/webrick/httpresponse.rb:260: warning: instance variable @upgrade not initialized
F
==========================================================================================================
     60:       io.rewind
     61:       res = Net::HTTPResponse.read_new(Net::BufferedIO.new(io))
     62:       assert_equal '500', res.code
  => 63:       refute_match 'cracked_indicator_for_test', io.string
     64:     end
     65: 
     66:     def test_prevent_response_splitting_cookie_headers_cr
/tmp/guix-build-ruby-webrick-1.8.1.drv-1/source/test/webrick/test_httpresponse.rb:63:in `test_prevent_response_splitting_headers_cr'
Failure: test_prevent_response_splitting_headers_cr(WEBrick::TestHTTPResponse):
  <REGEXP> in assert_not_match(<REGEXP>, ...) should be a Regexp.
  <"cracked_indicator_for_test"> was expected to be instance_of?
  <Regexp> but was
  <String>.
==========================================================================================================
/tmp/guix-build-ruby-webrick-1.8.1.drv-1/source/lib/webrick/httpresponse.rb:260: warning: instance variable @upgrade not initialized
F
==========================================================================================================
     39:       io.rewind
     40:       res = Net::HTTPResponse.read_new(Net::BufferedIO.new(io))
     41:       assert_equal '500', res.code
  => 42:       refute_match 'cracked_indicator_for_test', io.string
     43:     end
     44: 
     45:     def test_prevent_response_splitting_cookie_headers_crlf
/tmp/guix-build-ruby-webrick-1.8.1.drv-1/source/test/webrick/test_httpresponse.rb:42:in `test_prevent_response_splitting_headers_crlf'
Failure: test_prevent_response_splitting_headers_crlf(WEBrick::TestHTTPResponse):
  <REGEXP> in assert_not_match(<REGEXP>, ...) should be a Regexp.
  <"cracked_indicator_for_test"> was expected to be instance_of?
  <Regexp> but was
  <String>.
==========================================================================================================
/tmp/guix-build-ruby-webrick-1.8.1.drv-1/source/lib/webrick/httpresponse.rb:260: warning: instance variable @upgrade not initialized
F
==========================================================================================================
     81:       io.rewind
     82:       res = Net::HTTPResponse.read_new(Net::BufferedIO.new(io))
     83:       assert_equal '500', res.code
  => 84:       refute_match 'cracked_indicator_for_test', io.string
     85:     end
     86: 
     87:     def test_prevent_response_splitting_cookie_headers_lf
/tmp/guix-build-ruby-webrick-1.8.1.drv-1/source/test/webrick/test_httpresponse.rb:84:in `test_prevent_response_splitting_headers_lf'
Failure: test_prevent_response_splitting_headers_lf(WEBrick::TestHTTPResponse):
  <REGEXP> in assert_not_match(<REGEXP>, ...) should be a Regexp.
  <"cracked_indicator_for_test"> was expected to be instance_of?
  <Regexp> but was
  <String>.
==========================================================================================================
...../tmp/guix-build-ruby-webrick-1.8.1.drv-1/source/lib/webrick/httpresponse.rb:260: warning: instance variable @upgrade not initialized
......./tmp/guix-build-ruby-webrick-1.8.1.drv-1/source/lib/webrick/httpresponse.rb:260: warning: instance variable @upgrade not initialized
..
Finished in 7.279902005 seconds.
----------------------------------------------------------------------------------------------------------
138 tests, 790 assertions, 6 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
95.6522% passed
----------------------------------------------------------------------------------------------------------
18.96 tests/s, 108.52 assertions/s
rake aborted!
Command failed with status (1)

Any idea what they could be caused by?

Thanks!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with test/webrick/test_httpresponse.rb, especially the six failing response-splitting tests and their refute_match calls, then inspect lib/webrick/httpresponse.rb around the reported line 260. Run the test suite under Ruby 2.7.4 and determine what change makes the tests pass without the reported warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.