http proxy not supported

Bug #745634 reported by Emiliano Parasassi
28
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Weather Indicator
Fix Released
Medium
Unassigned

Bug Description

Indicator-Weather doesn't acquire data behind http[s] proxy.
I've set proxy address with 'gnome-network-properties' utility without applying it globally (system-wide).
The application remains in an eternal refreshing status.

Changed in weather-indicator:
importance: Undecided → Medium
milestone: none → backlog
status: New → Confirmed
Revision history for this message
Panagiotis Skintzos (ph7) wrote :

I use a proxy (squid3 in my local net) and I have no problem.
Is it perhaps a problem in the proxy? Can you access the urls that fail from the browser or wget?

Revision history for this message
Emiliano Parasassi (millallo) wrote : Re: [Bug 745634] Re: http proxy not supported

Hi Panagiotis,
At home i have no proxy and indicator works fine.
At work i can surf the internet only with a proxy which has no
restrictions, and indicators doesn't acquire weather data.
If you give me some tricks to debug my indicator, i can collect more info about.

Have you sniffed your traffic with wireshark and verified that
everything passes trough your proxy? Is not very easy to check when
the proxy is on the same host.
Should you create an ad-hoc virtual machine with a proxy or use a
proxy installed on another host?

greetings
e.

On Thu, Mar 31, 2011 at 23:04, Panagiotis Skintzos
<email address hidden> wrote:
> I use a proxy (squid3 in my local net) and I have no problem.
> Is it perhaps a problem in the proxy? Can you access the urls that fail from the browser or wget?
>
> --
> You received this bug notification because you are a direct subscriber
> of the bug.
> https://bugs.launchpad.net/bugs/745634
>
> Title:
>  http proxy not supported
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/weather-indicator/+bug/745634/+subscribe
>

Revision history for this message
Panagiotis Skintzos (ph7) wrote :

Hi Emiliano,
my proxy is in my server and I use the indicator from other machines in my lan.

Please attach the log file (~/.cache/indicator-weather.log)

You can run from the command line this:
/usr/share/doc/python-pywapi/examples/pywapi-example.py
Does it run successfully?

Revision history for this message
Emiliano Parasassi (millallo) wrote :

Hi Panagiotis,
your example script gave me the possibility to find the problem.

Your script works fine behind a proxy if it is called with the
environment variable 'http_proxy' and i can read the weather of New
York .

Unfortunately my indicator lives in an environment which doens't have
this variable because it is not set at login time.
To reproduce my indicator behaviour to the following:

- launch gnome-network-properties and set 'no proxy' globally.
- logout and login.
- ensure you doen't have the variable 'http_proxy' set in a terminal
(echo $http_proxy).
- launch gnome-network-properties a now set your proxy.
- Weather indicator doesn't works because his environment doesn't
changed, http_proxy isn't set! ...this is my case when i start working
and i change the proxy!

So, seems that the python interpreter search the proxy only in the
environment and doesn't check the gnome proxy like firefox or chrome
do...
Is possible in python retrieve proxy configuration in the gnome desktop session?

best regards
emiliano

On Fri, Apr 1, 2011 at 10:56, Panagiotis Skintzos
<email address hidden> wrote:
> Hi Emiliano,
> my proxy is in my server and I use the indicator from other machines in my lan.
>
> Please attach the log file (~/.cache/indicator-weather.log)
>
> You can run from the command line this:
> /usr/share/doc/python-pywapi/examples/pywapi-example.py
> Does it run successfully?
>
> --
> You received this bug notification because you are a direct subscriber
> of the bug.
> https://bugs.launchpad.net/bugs/745634
>
> Title:
>  http proxy not supported
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/weather-indicator/+bug/745634/+subscribe
>

Revision history for this message
Panagiotis Skintzos (ph7) wrote :

Hmm, I don't seem have the http_proxy env variable set either (but I have a direct internet connection as well, so I think that one is used).

It's not a matter of python interpreter, rather it's the urllib2 that is failing to autodetect the proxy.
Please open the command line and run this line
python -c "import os; print '\n'.join(os.environ.keys());" | grep -i proxy
Do you get back something like HTTP_PROXY or is it an empty line?
If you start the indicator after you've set the proxy does it work right?

Revision history for this message
Emiliano Parasassi (millallo) wrote :

On Fri, Apr 1, 2011 at 15:11, Panagiotis Skintzos
<email address hidden> wrote:
> Hmm, I don't seem have the http_proxy env variable set either (but I
> have a direct internet connection as well, so I think that one is used).
>
> It's not a matter of python interpreter, rather it's the urllib2 that is failing to autodetect the proxy.
> Please open the command line and run this line
> python -c "import os; print '\n'.join(os.environ.keys());" | grep -i proxy

if i have the http_proxy set, i get:
http_proxy
UBUNTU_MENUPROXY

if i have not the http_proxy set, i get:
UBUNTU_MENUPROXY

> Do you get back something like HTTP_PROXY or is it an empty line?
> If you start the indicator after you've set the proxy does it work right?

After setting the proxy via gnome:
- if i launch the indicator in a terminal with the http_proxy set,
everything works fine, else not.
- if i launch the indicator with unity (which doesn't have the
http_proxy set since login time), no luck :(

Revision history for this message
Panagiotis Skintzos (ph7) wrote :

Ok, I see. To solve this we need to monitor for http proxy setting changes, as urllib2 does not do that.
I made a patch, that reads and monitors gconf http proxy settings and it installs a ProxyHandler opener in urllib2.
It requires python-gconf as dependency though.
It seems to work on my side; all requests (including pywapi ) appear on the proxy logs
It would be great if you can apply the patch and report if it works.

Revision history for this message
Emiliano Parasassi (millallo) wrote :

Hi Panagiotis,
the patch works great!
Thank you very much.

regards
emiliano

On Fri, Apr 1, 2011 at 17:36, Panagiotis Skintzos
<email address hidden> wrote:
> Ok, I see. To solve this we need to monitor for http proxy setting changes, as urllib2 does not do that.
> I made a patch, that reads and monitors gconf http proxy settings and it installs a ProxyHandler opener in urllib2.
> It requires python-gconf as dependency though.
> It seems to work on my side; all requests (including pywapi ) appear on the proxy logs
> It would be great if you can apply the patch and report if it works.
>
> ** Patch added: "http_proxy_support.patch"
>   https://bugs.launchpad.net/weather-indicator/+bug/745634/+attachment/1964370/+files/http_proxy_support.patch
>
> --
> You received this bug notification because you are a direct subscriber
> of the bug.
> https://bugs.launchpad.net/bugs/745634
>
> Title:
>  http proxy not supported
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/weather-indicator/+bug/745634/+subscribe
>

Revision history for this message
Vadim Rutkovsky (roignac) wrote :

Great job, Panagiotis!
Applied the patch, but for the future - this should be rewritten slightly for dconf, so we could avoid unnecessary gconf dependency.

Changed in weather-indicator:
milestone: backlog → cloudy-3
status: Confirmed → Fix Committed
Changed in weather-indicator:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.