Skip to content

HTTPS proxy is only enabled if the proxied connection is also SSL #210

Open
@ag-TJNII

Description

@ag-TJNII
irb(main):001> require 'net/http'
=> true
irb(main):002> n = Net::HTTP.new('192.0.2.10', 80, '127.0.0.1', 5000, nil, nil, nil, true)
=> #<Net::HTTP 192.0.2.10:80 open=false>
irb(main):003> n.instance_variable_get(:@proxy_use_ssl)
=> true
irb(main):004> n.start
=> #<Net::HTTP 192.0.2.10:80 open=true>
irb(main):005> n.get('/')

Data sent to the listener at 127.0.0.1:5000:

GET http://192.0.2.10/ HTTP/1.1
Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Accept: */*
User-Agent: Ruby
Host: 192.0.2.10

This is due to the proxy SSL socket setup being inside a if use_ssl? block.

https://github.com/ruby/net-http/blob/master/lib/net/http.rb#L1667-L1674

Transporting clear HTTP over a HTTPS proxy is a valid configuration, the library should support this.

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