[tomboy] Cache libproxy's factory



commit 65289e7b17be3e6011984c2ece7d646fa3a9cfca
Author: Aaron Borden <adborden shift>
Date:   Thu Oct 4 00:42:49 2012 -0700

    Cache libproxy's factory
    
    Avoid zombie processes from reading proxy settings.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=677561
    
    Signed-off-by: Jared Jennings <jared jaredjennings org>

 .../Addins/WebSyncService/Api/ProxiedWebRequest.cs |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/Tomboy/Addins/WebSyncService/Api/ProxiedWebRequest.cs 
b/Tomboy/Addins/WebSyncService/Api/ProxiedWebRequest.cs
index 72cd9a2..671b043 100644
--- a/Tomboy/Addins/WebSyncService/Api/ProxiedWebRequest.cs
+++ b/Tomboy/Addins/WebSyncService/Api/ProxiedWebRequest.cs
@@ -6,7 +6,8 @@ using LibProxy;
 namespace Tomboy.WebSync
 {
        public static class ProxiedWebRequest
-       {               
+       {
+               private static ProxyFactory proxyFactory = null;
                private const string useProxyAuthentication =
                        "/system/http_proxy/use_authentication";
                private const string proxyAuthenticationUser =
@@ -32,9 +33,11 @@ namespace Tomboy.WebSync
                
                private static void ApplyProxy (HttpWebRequest webRequest, string uri)
                {
-                       ProxyFactory pf = new LibProxy.ProxyFactory ();
-                       string[] proxies = pf.GetProxies (uri);
-                       
+                       if (proxyFactory == null) {
+                               proxyFactory = new LibProxy.ProxyFactory ();
+                       }
+
+                       string[] proxies = proxyFactory.GetProxies (uri);
                        foreach (string proxy in proxies) {
                                Uri proxyUri = new Uri (proxy);
                                string scheme = proxyUri.Scheme;


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