Package: reportbug-ng
Version: 1.24

--- Please enter the report below this line. ---

The attached patch will make the web viewer use the proxy set in
http_proxy environment variable.

This patch, along with python-debianbts patch in
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=630496 will enable
proxy utilization by reportbug-ng.

Proxy authentication, however, is not implemented. A workaround is to
use squid to perform upstream web proxy authentication
(http://hints.macworld.com/article.php?story=20030226161459306) and
make:
http_proxy=http://localhost:3128

--- System information. ---
Architecture: amd64
Kernel:       Linux 2.6.39-2-amd64

Debian Release: wheezy/sid
  500 testing         sft.if.usp.br
  500 testing         linorg.usp.br
  500 squeeze-backports mozilla.debian.net
  500 maverick        ppa.launchpad.net
  200 unstable        sft.if.usp.br

--- Package information. ---
Depends                (Version) | Installed
================================-+-============
python                           | 2.6.6-14
python-support       (>= 0.90.0) | 1.0.13
python-debianbts        (>= 1.0) | 1.10
python-qt4                       | 4.8.3-2+b1
xdg-utils                        | 1.1.0~rc1-2
xterm                            | 270-1
python-apt           (>= 0.7.93) | 0.8.0


Package's Recommends field is empty.

Package's Suggests field is empty.
--- reportbug-ng-1.24.orig/src/reportbug-ng	2009-10-25 15:23:36.000000000 -0200
+++ reportbug-ng-1.24/src/reportbug-ng	2011-06-14 13:54:30.719994825 -0300
@@ -22,6 +22,7 @@
 sys.path.append('/usr/share/reportbug-ng')
 import logging
 from optparse import OptionParser
+from os import environ
 
 from PyQt4 import QtCore, QtGui
 
@@ -64,6 +65,18 @@
     logging.basicConfig(level=loglevel, format='%(name)-12s %(levelname)-8s %(message)s')
     logging.info('Logger initialized with level %s.' % options.loglevel)
 
+    http_proxy = environ.get("http_proxy")
+    if http_proxy:
+        import re
+        proxy_re = re.compile('(http://)?([^:/]*)(:([0-9]+))?/?')
+        match = proxy_re.match(http_proxy)
+        if match:
+            from PyQt4 import QtNetwork
+            proxy = QtNetwork.QNetworkProxy()
+            proxy.setType(QtNetwork.QNetworkProxy.HttpProxy)
+            proxy.setHostName(match.group(2));
+            proxy.setPort(int(match.group(4) or '80'))
+            QtNetwork.QNetworkProxy.setApplicationProxy(proxy);
     app = QtGui.QApplication(sys.argv)
     translator = QtCore.QTranslator()
     locale = QtCore.QLocale.system().name()

Reply via email to