Skip to content

HTTPS proxy support #42

@olivier-thatch

Description

@olivier-thatch

Hello,

The docs at https://honeyryderchuck.gitlab.io/httpx/wiki/Proxy say that HTTPX does support HTTPS proxies:

# Use an HTTPS `CONNECT` proxy to tunnel secure HTTP(S) requests.
HTTPX.plugin(:proxy).with_proxy(uri: "https://10.10.0.1:51432").get("https://google.pt")

However, running the above code produces the following error:

irb(main):001> require "httpx"
=> true

irb(main):002> HTTPX.plugin(:proxy).with_proxy(uri: "https://10.10.0.1:51432").get("https://google.pt")
/Users/olivier/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/httpx-1.2.3/lib/httpx/plugins/proxy.rb:128:in `find_connection': https: unsupported proxy protocol (HTTPX::HTTPProxyError)
	from /Users/olivier/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/httpx-1.2.3/lib/httpx/session.rb:131:in `block in send_request'
	from /Users/olivier/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/httpx-1.2.3/lib/httpx/session.rb:130:in `catch'
	from /Users/olivier/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/httpx-1.2.3/lib/httpx/session.rb:130:in `send_request'
	from /Users/olivier/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/httpx-1.2.3/lib/httpx/session.rb:242:in `block in _send_requests'
	from /Users/olivier/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/httpx-1.2.3/lib/httpx/session.rb:241:in `each'
	from /Users/olivier/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/httpx-1.2.3/lib/httpx/session.rb:241:in `_send_requests'
	from /Users/olivier/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/httpx-1.2.3/lib/httpx/session.rb:233:in `send_requests'
	from /Users/olivier/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/httpx-1.2.3/lib/httpx/session.rb:72:in `request'
	from /Users/olivier/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/httpx-1.2.3/lib/httpx/chainable.rb:10:in `get'
	from (irb):2:in `<main>'
	from <internal:kernel>:187:in `loop'
	from /Users/olivier/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/irb-1.11.2/exe/irb:9:in `<top (required)>'
	from /Users/olivier/.rbenv/versions/3.3.0/bin/irb:25:in `load'
	from /Users/olivier/.rbenv/versions/3.3.0/bin/irb:25:in `<top (required)>'
	from /Users/olivier/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bundler-2.5.3/lib/bundler/cli/exec.rb:58:in `load'
	from /Users/olivier/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bundler-2.5.3/lib/bundler/cli/exec.rb:58:in `kernel_load'
	... 13 levels...

Taking a quick look at the source, it does look like HTTPS is indeed unsupported and the docs are incorrect.

Can you confirm whether HTTPX supports HTTPS proxies or not, and if not, whether this feature is planned for a future release?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions