[libsoup] SoupConnection: Explicitly set SoupAddress protocol.



commit 3c4cea7bcc7dd44d61bf1d87a4ec8dce99a875cf
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Feb 17 10:05:36 2014 -0500

    SoupConnection: Explicitly set SoupAddress protocol.
    
    So GProxyResolver can distinguish between "http" and "https" requests,
    and choose the appropriate proxy settings.  Previously the SoupAddress
    protocol was left unset, so soup_address_connectable_proxy_enumerate()
    assumed "http".
    
    https://bugzilla.gnome.org/show_bug.cgi?id=724316

 libsoup/soup-connection.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/libsoup/soup-connection.c b/libsoup/soup-connection.c
index 2b5dc49..fce589f 100644
--- a/libsoup/soup-connection.c
+++ b/libsoup/soup-connection.c
@@ -532,8 +532,14 @@ soup_connection_connect_async (SoupConnection      *conn,
 
        soup_connection_set_state (conn, SOUP_CONNECTION_CONNECTING);
 
-       remote_addr = soup_address_new (priv->remote_uri->host,
-                                       priv->remote_uri->port);
+       /* Set the protocol to ensure correct proxy resolution. */
+       remote_addr =
+               g_object_new (SOUP_TYPE_ADDRESS,
+                             SOUP_ADDRESS_NAME, priv->remote_uri->host,
+                             SOUP_ADDRESS_PORT, priv->remote_uri->port,
+                             SOUP_ADDRESS_PROTOCOL, priv->remote_uri->scheme,
+                             NULL);
+
        priv->socket =
                soup_socket_new (SOUP_SOCKET_REMOTE_ADDRESS, remote_addr,
                                 SOUP_SOCKET_SSL_CREDENTIALS, priv->tlsdb,
@@ -583,7 +589,14 @@ soup_connection_connect_sync (SoupConnection  *conn,
 
        soup_connection_set_state (conn, SOUP_CONNECTION_CONNECTING);
 
-       remote_addr = soup_address_new (priv->remote_uri->host, priv->remote_uri->port);
+       /* Set the protocol to ensure correct proxy resolution. */
+       remote_addr =
+               g_object_new (SOUP_TYPE_ADDRESS,
+                             SOUP_ADDRESS_NAME, priv->remote_uri->host,
+                             SOUP_ADDRESS_PORT, priv->remote_uri->port,
+                             SOUP_ADDRESS_PROTOCOL, priv->remote_uri->scheme,
+                             NULL);
+
        priv->socket =
                soup_socket_new (SOUP_SOCKET_REMOTE_ADDRESS, remote_addr,
                                 SOUP_SOCKET_PROXY_RESOLVER, priv->proxy_resolver,


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