Impossible to use Net::HTTP option for ignoring proxy set in environment

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

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
50/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
ruby
Domain
networking

Research direction

Start at lib/httparty/connection_adapter.rb around line 73 and read the linked Net::HTTP.new documentation, focusing on how a nil proxy address affects proxy_from_env. Confirm the connection setup allows the option to disable environment proxy usage; done means the documented option works without the conditional blocking nil values.

Written by the indexing model from the issue text.

Description

L: 73
lib/httparty/connection_adapter.rb

    def connection
      host = clean_host(uri.host)
      if options[:http_proxyaddr]
        http = Net::HTTP.new(host, uri.port, options[:http_proxyaddr], options[:http_proxyport], options[:http_proxyuser], options[:http_proxypass])
      else
        http = Net::HTTP.new(host, uri.port)
      end

http://ruby-doc.org/stdlib-2.1.2/libdoc/net/http/rdoc/Net/HTTP.html#method-c-new

one must pass nil to proxy address to disable the usage of proxy_from_env

Solution:
drop the if statement, Net::HTTP.new will accept nil's

Dominant language
Ruby
Stars
5.9k
Forks
973
Avg merge
1h 59m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

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.

More from jnunemaker/httparty

All issues in jnunemaker/httparty

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.