Skip to content

fail to fetch proxy user/pw from env variable #68

@kaisecheng

Description

@kaisecheng

http.rb use RUBY_PLATFORM to decide the source of username/ password of the proxy. RUBY_PLATFORM of jruby is java. It blocks jruby user from using proxy with env variable

ruby --version
jruby 9.3.6.0 (2.6.8) 2022-06-27 7a2cbcd376 OpenJDK 64-Bit Server VM 11.0.15+10 on 11.0.15+10 +jit [x86_64-darwin]

reproduce steps

  1. export JRUBY_OPTS='-J-Dhttps.proxyHost=user:pw@host -J-Dhttps.proxyPort=3128 -J-Dhttp.proxyHost=user:pw@host -J-Dhttp.proxyPort=3128'
  2. ruby -e "require 'net/http'; uri = URI('https://www.google.com'); Net::HTTP.get(uri);"

log

Net::HTTPServerException: 407 "Proxy Authentication Required"
        error! at /Users/kcheng/.rbenv/versions/jruby-9.3.6.0/lib/ruby/stdlib/net/http/response.rb:122
         value at /Users/kcheng/.rbenv/versions/jruby-9.3.6.0/lib/ruby/stdlib/net/http/response.rb:131
       connect at /Users/kcheng/.rbenv/versions/jruby-9.3.6.0/lib/ruby/stdlib/net/http.rb:973
      do_start at /Users/kcheng/.rbenv/versions/jruby-9.3.6.0/lib/ruby/stdlib/net/http.rb:934
         start at /Users/kcheng/.rbenv/versions/jruby-9.3.6.0/lib/ruby/stdlib/net/http.rb:923
         start at /Users/kcheng/.rbenv/versions/jruby-9.3.6.0/lib/ruby/stdlib/net/http.rb:605
  get_response at /Users/kcheng/.rbenv/versions/jruby-9.3.6.0/lib/ruby/stdlib/net/http.rb:481
           get at /Users/kcheng/.rbenv/versions/jruby-9.3.6.0/lib/ruby/stdlib/net/http.rb:458
        <main> at -e:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions