Cannot update Twitter status behind proxy

Bug #1166369 reported by Ronald Blaschke on 2013-04-08
This bug affects 2 people
Affects Status Importance Assigned to Milestone

Bug Description

I am using Gwibber on an up-to-date Ubuntu 12.10 machine, with Python 2.7.3 and Gwibber 3.6.0.

Updating the Twitter status works when running Gwibber without a HTTP proxy. When using a proxy, the update fails.
The gwibber.log shows this generic error message.

Network Thread-1 : ERROR - Network failure: UNKNOWN

The actual error is:

Network Thread-1 : ERROR - Network failure: maximum recursion depth exceeded
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/gwibber/microblog/", line 35, in __init__
    self.res = urllib2.urlopen(req)
  File "/usr/lib/python2.7/", line 127, in urlopen
    return, data, timeout)
  File "/usr/lib/python2.7/", line 401, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/", line 419, in _open
    '_open', req)
  File "/usr/lib/python2.7/", line 379, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/dist-packages/gwibber/microblog/uploader/imageshack/", line 233, in https_open
    return self.do_open(httplib.HTTPS, req)
  File "/usr/lib/python2.7/dist-packages/gwibber/microblog/uploader/imageshack/", line 189, in do_open
    h.putrequest('GET', req.get_selector())
  File "/usr/lib/python2.7/", line 266, in get_selector
    return self.__r_host
  File "/usr/lib/python2.7/", line 225, in __getattr__
    return getattr(self, attr)
  File "/usr/lib/python2.7/", line 225, in __getattr__
    return getattr(self, attr)
  File "/usr/lib/python2.7/", line 225, in __getattr__
    return getattr(self, attr)
  File "/usr/lib/python2.7/", line 225, in __getattr__
    return getattr(self, attr)

After digging a bit in the code, I noticed this monkey patching in gwibber/microblog/uploader/imageshack/, around line 228.
urllib2._old_HTTPHandler = urllib2.HTTPHandler
urllib2.HTTPHandler = newHTTPHandler
urllib2.HTTPSHandler = newHTTPSHandler

If I comment out those three lines, updating the Twitter status works for me again, even behind a proxy.

If the modified handlers are still necessary, they may need some update to work with Python 2.7.3 urllib2?

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers