Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kaisecheng opened this issue Sep 6, 2022 · 1 comment
Open

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

kaisecheng opened this issue Sep 6, 2022 · 1 comment

Comments

@kaisecheng
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant