summaryrefslogtreecommitdiff
blob: d063f8b598d862987ef8606b6e25f5cb1bad61c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
commit 1804c2fde7bf4e432c6cf5bb8cce5701c7010559
Author: Albert Astals Cid <aacid@kde.org>
Date:   Tue Feb 28 19:08:50 2017 +0100

    Sanitize URLs before passing them to FindProxyForURL
    
    Remove user/password information
    For https: remove path and query
    
    Backport from kio f9d0cb47cf94e209f6171ac0e8d774e68156a6e4

diff --git a/kio/misc/kpac/script.cpp b/kio/misc/kpac/script.cpp
index a595301307..9ab360a0b5 100644
--- a/kio/misc/kpac/script.cpp
+++ b/kio/misc/kpac/script.cpp
@@ -754,9 +754,16 @@ namespace KPAC
             }
         }
 
+        KUrl cleanUrl = url;
+        cleanUrl.setUserInfo(QString());
+        if (cleanUrl.scheme().toLower() == QLatin1String("https")) {
+            cleanUrl.setPath(QString());
+            cleanUrl.setQuery(QString());
+        }
+
         QScriptValueList args;
-        args << url.url();
-        args << url.host();
+        args << cleanUrl.url();
+        args << cleanUrl.host();
 
         QScriptValue result = func.call(QScriptValue(), args);
         if (result.isError()) {