diff options
author | Dan Winship <danw@gnome.org> | 2013-01-26 20:06:50 -0500 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2013-02-16 18:02:15 -0500 |
commit | ed6f1cdcd72e6e3e9076f5440977e45ed1911811 (patch) | |
tree | 84e3588ef28011e37a7593b365809ae620d3fd85 | |
parent | cf558c8514686851b8eea544a0b110c7d705ea9e (diff) | |
download | libsoup-ed6f1cdcd72e6e3e9076f5440977e45ed1911811.tar.gz libsoup-ed6f1cdcd72e6e3e9076f5440977e45ed1911811.tar.bz2 libsoup-ed6f1cdcd72e6e3e9076f5440977e45ed1911811.zip |
SoupSession: remove some dead code, fix proxy error messages
SoupMessageQueueItem's proxy_addr and proxy_uri fields were no longer
being used, but they were still there, and SoupSession was trying to
use item->proxy_uri to provide clarifying information on
SOUP_STATUS_CANT_RESOLVE_PROXY / SOUP_STATUS_CANT_CONNECT_PROXY.
Remove the unused fields, and fix SoupSession to get the proxy name
from the SoupConnection instead.
https://bugzilla.gnome.org/show_bug.cgi?id=680273
-rw-r--r-- | libsoup/soup-message-queue.c | 11 | ||||
-rw-r--r-- | libsoup/soup-message-queue.h | 2 | ||||
-rw-r--r-- | libsoup/soup-session.c | 33 |
3 files changed, 14 insertions, 32 deletions
diff --git a/libsoup/soup-message-queue.c b/libsoup/soup-message-queue.c index ac00f163..c7661d8c 100644 --- a/libsoup/soup-message-queue.c +++ b/libsoup/soup-message-queue.c @@ -58,15 +58,6 @@ queue_message_restarted (SoupMessage *msg, gpointer user_data) { SoupMessageQueueItem *item = user_data; - if (item->proxy_addr) { - g_object_unref (item->proxy_addr); - item->proxy_addr = NULL; - } - if (item->proxy_uri) { - soup_uri_free (item->proxy_uri); - item->proxy_uri = NULL; - } - g_cancellable_reset (item->cancellable); } @@ -171,8 +162,6 @@ soup_message_queue_item_unref (SoupMessageQueueItem *item) g_object_unref (item->session); g_object_unref (item->msg); g_object_unref (item->cancellable); - g_clear_object (&item->proxy_addr); - g_clear_pointer (&item->proxy_uri, soup_uri_free); g_clear_object (&item->task); if (item->io_source) { g_source_destroy (item->io_source); diff --git a/libsoup/soup-message-queue.h b/libsoup/soup-message-queue.h index 490f9a29..848ecd02 100644 --- a/libsoup/soup-message-queue.h +++ b/libsoup/soup-message-queue.h @@ -38,8 +38,6 @@ struct _SoupMessageQueueItem { GMainContext *async_context; GCancellable *cancellable; - SoupAddress *proxy_addr; - SoupURI *proxy_uri; SoupConnection *conn; GTask *task; GSource *io_source; diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c index 009b6bed..ab13ca9e 100644 --- a/libsoup/soup-session.c +++ b/libsoup/soup-session.c @@ -1451,45 +1451,40 @@ soup_session_set_item_status (SoupSession *session, SoupMessageQueueItem *item, guint status_code) { - SoupURI *uri; - char *msg; + SoupURI *uri = NULL; switch (status_code) { case SOUP_STATUS_CANT_RESOLVE: case SOUP_STATUS_CANT_CONNECT: uri = soup_message_get_uri (item->msg); - msg = g_strdup_printf ("%s (%s)", - soup_status_get_phrase (status_code), - uri->host); - soup_message_set_status_full (item->msg, status_code, msg); - g_free (msg); break; case SOUP_STATUS_CANT_RESOLVE_PROXY: case SOUP_STATUS_CANT_CONNECT_PROXY: - if (item->proxy_uri && item->proxy_uri->host) { - msg = g_strdup_printf ("%s (%s)", - soup_status_get_phrase (status_code), - item->proxy_uri->host); - soup_message_set_status_full (item->msg, status_code, msg); - g_free (msg); - break; - } - soup_message_set_status (item->msg, status_code); + if (item->conn) + uri = soup_connection_get_proxy_uri (item->conn); break; case SOUP_STATUS_SSL_FAILED: if (!g_tls_backend_supports_tls (g_tls_backend_get_default ())) { soup_message_set_status_full (item->msg, status_code, "TLS/SSL support not available; install glib-networking"); - } else - soup_message_set_status (item->msg, status_code); + return; + } break; default: - soup_message_set_status (item->msg, status_code); break; } + + if (uri && uri->host) { + char *msg = g_strdup_printf ("%s (%s)", + soup_status_get_phrase (status_code), + uri->host); + soup_message_set_status_full (item->msg, status_code, msg); + g_free (msg); + } else + soup_message_set_status (item->msg, status_code); } |