Skip to content

Fix warnings emitted from httpclient's own code in CI - #487

Open
yahonda wants to merge 5 commits into
nahi:masterfrom
yahonda:fix-warnings
Open

yahonda wants to merge 5 commits into
nahi:masterfrom
yahonda:fix-warnings

Conversation

@yahonda

@yahonda yahonda commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Summary

The CI run on master shows the following warnings from httpclient's lib and tests. This pull request fixes them, one commit per warning:

  • lib/httpclient/jruby_ssl_socket.rb:128 and :361: literal string will be frozen in the future (JRuby)
  • test/helper.rb:9: CGI library is removed from Ruby 4.0. Please use cgi/escape instead for CGI.escape and CGI.unescape features.
  • test/test_auth.rb:131: method redefined; discarding old value
  • test-unit/assertions.rb:602: historical binary regexp match /.../n against UTF-8 string, caused by a /n regexp in test_post_with_file
  • test/test_httpclient.rb:771 and :779: setting Encoding.default_internal

Warnings raised inside dependencies (webrick, rack-ntlm-test-service, rubyntlm) are out of scope.

yahonda and others added 5 commits October 30, 2026 22:49
On JRuby these emit warnings when the buffer and PEM strings are
appended to:

    lib/httpclient/jruby_ssl_socket.rb:128: warning: literal string will be frozen in the future
    lib/httpclient/jruby_ssl_socket.rb:361: warning: literal string will be frozen in the future

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ruby 4.0 warns that the CGI library is removed:

    test/helper.rb:9: warning: CGI library is removed from Ruby 4.0. Please use cgi/escape instead for CGI.escape and CGI.unescape features.

The tests only use CGI.escape, which cgi/escape provides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Avoids the following warning, matching how data_size is already
redefined:

    test/test_auth.rb:131: warning: method redefined; discarding old value
    vendor/bundle/ruby/4.0.0/bundler/gems/rubyntlm-59ac920c56d8/lib/net/ntlm/security_buffer.rb:33: warning: previous definition of value was here

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Matching a /n regexp against a UTF-8 string warns:

    vendor/bundle/ruby/4.0.0/gems/test-unit-3.7.8/lib/test/unit/assertions.rb:602: warning: historical binary regexp match /.../n against UTF-8 string

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
test_post_async_with_default_internal sets Encoding.default_internal on
purpose, so wrap the assignments with the existing silent helper:

    test/test_httpclient.rb:771: warning: setting Encoding.default_internal
    test/test_httpclient.rb:779: warning: setting Encoding.default_internal

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant