[Pkg-owncloud-commits] [owncloud-client] 20/94: owncloudcmd: Set proxy earlier #6281

Sandro Knauß hefee at debian.org
Thu Mar 29 11:12:10 UTC 2018


This is an automated email from the git hooks/post-receive script.

hefee pushed a commit to branch upstream
in repository owncloud-client.

commit 81baebf113b725b91234e400bf4a2fce3f0281ed
Author: Christian Kamm <mail at ckamm.de>
Date:   Fri Jan 5 10:23:29 2018 +0100

    owncloudcmd: Set proxy earlier #6281
    
    In particular before the capability call.
    
    Also warn if no proxy is set because the command line doesn't follow the
    strict format requirements.
    
    (cherry picked from commit d0e7f61db62b52af9c94e9a97e1d201a09c2bd1a)
---
 src/cmd/cmd.cpp | 47 ++++++++++++++++++++++++-----------------------
 1 file changed, 24 insertions(+), 23 deletions(-)

diff --git a/src/cmd/cmd.cpp b/src/cmd/cmd.cpp
index 0a519e9..9385fc7 100644
--- a/src/cmd/cmd.cpp
+++ b/src/cmd/cmd.cpp
@@ -420,6 +420,30 @@ int main(int argc, char **argv)
         folder.chop(1);
     }
 
+    if (!options.proxy.isNull()) {
+        QString host;
+        int port = 0;
+        bool ok;
+
+        QStringList pList = options.proxy.split(':');
+        if (pList.count() == 3) {
+            // http: //192.168.178.23 : 8080
+            //  0            1            2
+            host = pList.at(1);
+            if (host.startsWith("//"))
+                host.remove(0, 2);
+
+            port = pList.at(2).toInt(&ok);
+
+            QNetworkProxyFactory::setUseSystemConfiguration(false);
+            QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::HttpProxy, host, port));
+        } else {
+            qFatal("Could not read httpproxy. The proxy should have the format \"http://hostname:port\".");
+        }
+    } else {
+        clientProxy.setupQtProxyFromConfig();
+    }
+
     SimpleSslErrorHandler *sslErrorHandler = new SimpleSslErrorHandler;
 
     HttpCredentialsText *cred = new HttpCredentialsText(user, password);
@@ -457,31 +481,8 @@ int main(int argc, char **argv)
     int restartCount = 0;
 restart_sync:
 
-
     opts = &options;
 
-    if (!options.proxy.isNull()) {
-        QString host;
-        int port = 0;
-        bool ok;
-
-        QStringList pList = options.proxy.split(':');
-        if (pList.count() == 3) {
-            // http: //192.168.178.23 : 8080
-            //  0            1            2
-            host = pList.at(1);
-            if (host.startsWith("//"))
-                host.remove(0, 2);
-
-            port = pList.at(2).toInt(&ok);
-
-            QNetworkProxyFactory::setUseSystemConfiguration(false);
-            QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::HttpProxy, host, port));
-        }
-    } else {
-        clientProxy.setupQtProxyFromConfig();
-    }
-
     QStringList selectiveSyncList;
     if (!options.unsyncedfolders.isEmpty()) {
         QFile f(options.unsyncedfolders);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list