Hey,

The problem seems to be related to the value http_proxy is set at. If it
starts with URI scheme like 'http://' or 'https://' proxy works fine.
However, if it doesn't, URI.parse seems to parse it incorrectly (empty
values) which makes HTTP.new to ignore proxy.


Holger, can you please confirm that this issue manifests itself only
when your http_proxy doesn't start with 'http://' or 'https://'?


I can think of two workarounds:

1. We can validate the provided http_proxy value with a regexp
($proxy_url =~ /^https?:\/\//i) and prepend 'http://' if it's missing
it. There are two problems here, however:
a) we assume that 'http://' is correct URI scheme
b) we will get a Ruby exception thrown when there is some weird
configuration like 'http:example.com' (missing '//')

2. We can check URI kind (proxy_uri.kind_of?(URI::HTTP) ||
proxy_uri.kind_of?(URI::HTTPS)) and if it is incorrect we can append
'http://'. Problems are similar to those in (1). The only difference
that in case of (b) we will download directly instead of getting an
exception.

In both cases, we should inform the user that since no URI scheme was
provided (or we didn't understand it) we will be trying to use http.


Regards,
T.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to