Re: [Tails-dev] minitube (Youtube client)

Delete this message

Reply to this message
Autor: Alessandro Grassi
Data:  
A: The Tails public development discussion list
Assumpte: Re: [Tails-dev] minitube (Youtube client)
Hi,

2012/12/14, intrigeri <intrigeri@???>:
> [..] that should be for another orthogonal patch: no sane
> upstream maintainer will accept a patch that supposedly "implements
> SOCKS5 support", but also silently changes the behaviour for HTTP
> proxy users. See what I mean? :)

Ok, I removed that last part from the patch. The upstream mantainer
will decide what's best :)

> So, the question now becomes: how does the stored history affect the
> behaviour of Minitube? Does it affect this behaviour in any way that
> could be observable on the network, or on the YouTube / Google / 3rd
> party servers that are reached? (I guess, and hope, the answers will
> unanimously be "no", but this is what should be checked.)

I searched for "recent" in the source files and didn't find anything
suspicious. There is code to save recent keywords, load them, clear
them with a button, but they shouldn't affect the behaviour in any
way. I hope someone else can confirm!

Greetings

Alessandro
--- minitube/src/global.h    2012-09-27 12:17:03.000000000 +0200
+++ global.h    2012-12-15 15:50:00.000000000 +0100
@@ -123,11 +123,72 @@
         }
     }


+    void networkSocks5ProxySetting() {
+        char *socks5_server_env;
+        socks5_server_env = std::getenv("socks5_server");
+        if (!socks5_server_env) {
+            socks5_server_env = std::getenv("SOCKS5_SERVER");
+        }
+
+        if (socks5_server_env) {
+            QString proxy_host = "";
+            QString proxy_port = "";
+            QString proxy_user = "";
+            QString proxy_pass = "";
+            QString socks5_server = QString(socks5_server_env);
+            socks5_server.remove(QRegExp("/$"));
+
+            // parse username and password
+            if (socks5_server.contains(QChar('@'))) {
+                QStringList socks5_server_list = socks5_server.split(QChar('@'));
+                QStringList socks5_server_user_pass = socks5_server_list[0].split(QChar(':'));
+                if (socks5_server_user_pass.size() > 0) {
+                    proxy_user = QUrl::fromPercentEncoding(socks5_server_user_pass[0].toUtf8());
+                }
+                if (socks5_server_user_pass.size() == 2) {
+                    proxy_pass = QUrl::fromPercentEncoding(socks5_server_user_pass[1].toUtf8());
+                }
+                if (socks5_server_list.size() > 1) {
+                    socks5_server = socks5_server_list[1];
+                }
+            }
+
+            // parse hostname and port
+            QStringList socks5_server_list = socks5_server.split(QChar(':'));
+            if (socks5_server_list.size() > 0) {
+                proxy_host = socks5_server_list[0];
+            }
+            if (socks5_server_list.size() > 1) {
+                proxy_port = socks5_server_list[1];
+            }
+
+            // set proxy setting
+            if (!proxy_host.isEmpty()) {
+                QNetworkProxy proxy;
+                proxy.setType(QNetworkProxy::Socks5Proxy);
+                proxy.setHostName(proxy_host);
+                if (!proxy_port.isEmpty()) {
+                    proxy.setPort(proxy_port.toUShort());
+                }
+                if (!proxy_user.isEmpty()) {
+                    proxy.setUser(proxy_user);
+                }
+                if (!proxy_pass.isEmpty()) {
+                    proxy.setPassword(proxy_pass);
+                }
+
+                qDebug() << "Using SOCKS5 proxy:" << socks5_server_env;
+                QNetworkProxy::setApplicationProxy(proxy);
+            }
+        }
+    }
+
     static QNetworkAccessManager *nam = 0;


     QNetworkAccessManager* networkAccessManager() {
         if (!nam) {
             networkHttpProxySetting();
+            networkSocks5ProxySetting();
             maybeSetSystemProxy();
             nam = new QNetworkAccessManager();
         }