Bug#742380: Debian bug #742380: please respect http_proxy settings

2014-03-23 Thread Tomasz Nitecki
Hey,

 I don't think it's sensible to work around broken configuration,
 http_proxy should specify http or https, so... I think closing this
 bug is right. Obviously feel free to reopen if you think thats
 appropriate.

Nah, I agree with you. I was only thinking about adding a warning about
incorrect http_proxy configuration (so a user is not surprised that we
try to connect without proxy), but I've decided against it. Lets keep
how-can-i-help simple and doing only what it is supposed to do.

Only one things bugs me - I do think that some applications (yes, wget
I'm looking at you) do work, even if they are given http_proxy without
URI scheme. I'll check that tomorrow.


Regards and thanks,
T.



signature.asc
Description: OpenPGP digital signature


Bug#742380: Debian bug #742380: please respect http_proxy settings

2014-03-22 Thread Tomasz Nitecki
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.



signature.asc
Description: OpenPGP digital signature