Skip to content

HTTP::ConnectionError on HTTPS queries through HTTP proxies #685

@ClearlyClaire

Description

@ClearlyClaire

Hi,
We are using the http gem in Mastodon, and I've been reported failures when using a HTTP proxy.

Upon investigation, it seems it occurs directly in the http gem and only fails with HTTPS URLs.

Indeed, the following works:

HTTP.via('127.0.0.1', 8118).get('http://httpbin.org/get')

But the following fails:

HTTP.via('127.0.0.1', 8118).get('https://httpbin.org/get')

It fails with the following error:

/home/mastodon/live/vendor/bundle/ruby/3.0.0/gems/http-5.0.1/lib/http/connection.rb:108:in `read_headers!': couldn't read response headers (HTTP::ConnectionError)
	from /home/mastodon/live/vendor/bundle/ruby/3.0.0/gems/http-5.0.1/lib/http/client.rb:76:in `perform'
	from /home/mastodon/live/vendor/bundle/ruby/3.0.0/gems/httplog-1.5.0/lib/httplog/adapters/http.rb:12:in `block (2 levels) in <class:Client>'
	from /usr/lib/ruby/3.0.0/benchmark.rb:308:in `realtime'
	from /home/mastodon/live/vendor/bundle/ruby/3.0.0/gems/httplog-1.5.0/lib/httplog/adapters/http.rb:11:in `block in <class:Client>'
	from /home/mastodon/live/vendor/bundle/ruby/3.0.0/gems/http-5.0.1/lib/http/client.rb:31:in `request'
	from /home/mastodon/live/vendor/bundle/ruby/3.0.0/gems/http-5.0.1/lib/http/chainable.rb:20:in `get'
	from (irb):1:in `<main>'

This also fails with http 5.0.0 but not with 4.4. Version 5.0.0pre3 seems to also work.

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