Fixed an issue in the web browser related to selecting the correct proxy type. 5_1_x

Wed, 25 May 2011 18:16:43 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 25 May 2011 18:16:43 +0200
branch
5_1_x
changeset 1060
e56185898d97
parent 1057
fed2f10ce334
child 1065
37dc3819ce14

Fixed an issue in the web browser related to selecting the correct proxy type.

E5Network/E5NetworkProxyFactory.py file | annotate | diff | comparison | revisions
--- a/E5Network/E5NetworkProxyFactory.py	Tue May 24 19:02:28 2011 +0200
+++ b/E5Network/E5NetworkProxyFactory.py	Wed May 25 18:16:43 2011 +0200
@@ -122,10 +122,10 @@
                     return [QNetworkProxy(QNetworkProxy.NoProxy)]
             else:
                 if Preferences.getUI("UseHttpProxyForAll"):
-                    protocol = "Http"
+                    protocolKey = "Http"
                 else:
-                    protocol = query.protocolTag().capitalize()
-                host = Preferences.getUI("ProxyHost/{0}".format(protocol))
+                    protocolKey = query.protocolTag().capitalize()
+                host = Preferences.getUI("ProxyHost/{0}".format(protocolKey))
                 if not host:
                     E5MessageBox.critical(None,
                         QCoreApplication.translate("E5NetworkProxyFactory", 
@@ -133,24 +133,20 @@
                         QCoreApplication.translate("E5NetworkProxyFactory", 
                             """Proxy usage was activated"""
                             """ but no proxy host for protocol"""
-                            """ '{0}' configured.""").format(protocol))
+                            """ '{0}' configured.""").format(protocolKey))
                     return [QNetworkProxy(QNetworkProxy.DefaultProxy)]
                 else:
-                    if protocol == "Http":
-                        proxy = QNetworkProxy(QNetworkProxy.HttpProxy, host, 
-                            Preferences.getUI("ProxyPort/Http"),
-                            Preferences.getUI("ProxyUser/Http"),
-                            Preferences.getUI("ProxyPassword/Http"))
-                    elif protocol == "Https":
-                        proxy = QNetworkProxy(QNetworkProxy.HttpCachingProxy, host, 
-                            Preferences.getUI("ProxyPort/Https"),
-                            Preferences.getUI("ProxyUser/Https"),
-                            Preferences.getUI("ProxyPassword/Https"))
-                    elif protocol == "Ftp":
-                        proxy = QNetworkProxy(QNetworkProxy.FtpCachingProxy, host, 
-                            Preferences.getUI("ProxyPort/Ftp"),
-                            Preferences.getUI("ProxyUser/Ftp"),
-                            Preferences.getUI("ProxyPassword/Ftp"))
+                    if protocolKey in ["Http", "Https", "Ftp"]:
+                        if query.protocolTag() == "ftp":
+                            proxyType = QNetworkProxy.FtpCachingProxy
+                        elif query.protocolTag() == "https":
+                            proxyType = QNetworkProxy.HttpCachingProxy
+                        else:
+                            proxyType = QNetworkProxy.HttpProxy
+                        proxy = QNetworkProxy(proxyType, host,
+                            Preferences.getUI("ProxyPort/" + protocolKey),
+                            Preferences.getUI("ProxyUser/" + protocolKey),
+                            Preferences.getUI("ProxyPassword/" + protocolKey))
                     else:
                         proxy = QNetworkProxy(QNetworkProxy.DefaultProxy)
                     return [proxy, QNetworkProxy(QNetworkProxy.DefaultProxy)]

eric ide

mercurial