[chrome-gnome-shell] connector: support update check through GNOME defined proxy.



commit 104d2139ad19ff067360fc64e1801a6aa2930066
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Sun Jul 16 00:07:41 2017 +0400

    connector: support update check through GNOME defined proxy.
    
    Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=784904

 connector/chrome-gnome-shell.py |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/connector/chrome-gnome-shell.py b/connector/chrome-gnome-shell.py
index 6679e51..a235256 100755
--- a/connector/chrome-gnome-shell.py
+++ b/connector/chrome-gnome-shell.py
@@ -536,10 +536,21 @@ class ChromeGNOMEShell(Gio.Application):
 
             http_request['installed'] = json.dumps(http_request['installed'])
 
+            proxies = Gio.ProxyResolver.get_default().lookup(update_url)
+            if proxies is not None:
+                proxy = proxies[0]
+                if proxy.startswith('direct'):
+                    proxies = None
+                else:
+                    proxies = {}
+                    for scheme in ('http', 'https'):
+                        proxies[scheme] = proxy
+
             try:
                 response = requests.get(
                     update_url,
                     params=http_request,
+                    proxies=proxies,
                     timeout=5
                 )
                 response.raise_for_status()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]