Actually disconnect the socket rather than just unreffing it, since the IO
authorDan Winship <danw@src.gnome.org>
Thu, 18 Dec 2003 21:36:01 +0000 (21:36 +0000)
committerDan Winship <danw@src.gnome.org>
Thu, 18 Dec 2003 21:36:01 +0000 (21:36 +0000)
* libsoup/soup-connection.c (soup_connection_disconnect): Actually
disconnect the socket rather than just unreffing it, since the IO
code may be holding an extra ref on it.
(send_request): connect to the "restarted" signal too
(request_restarted): Deal with "Connection: close"

* libsoup/soup-connection-ntlm.c (ntlm_authorize_pre): Make this
not go into an infinite loop if the server only supports Basic.

ChangeLog
libsoup/soup-connection-ntlm.c
libsoup/soup-connection.c

index 243e07e..594aced 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2003-12-18  Dan Winship  <danw@ximian.com>
+
+       * libsoup/soup-connection.c (soup_connection_disconnect): Actually
+       disconnect the socket rather than just unreffing it, since the IO
+       code may be holding an extra ref on it.
+       (send_request): connect to the "restarted" signal too
+       (request_restarted): Deal with "Connection: close"
+
+       * libsoup/soup-connection-ntlm.c (ntlm_authorize_pre): Make this
+       not go into an infinite loop if the server only supports Basic.
+
 2003-12-17  Rodrigo Moya <rodrigo@ximian.com>
 
        * libsoup/Makefile.am: install soup-message-queue.h with the rest
index 6724343..6872dbd 100644 (file)
@@ -99,6 +99,7 @@ ntlm_authorize_pre (SoupMessage *msg, gpointer user_data)
                val = headers->data;
                if (!strncmp (val, "NTLM ", 5))
                        break;
+               headers = headers->next;
        }
        if (!headers)
                return;
index 67bbfca..7c1535a 100644 (file)
@@ -462,6 +462,7 @@ soup_connection_disconnect (SoupConnection *conn)
 
        g_signal_handlers_disconnect_by_func (conn->priv->socket,
                                              socket_disconnected, conn);
+       soup_socket_disconnect (conn->priv->socket);
        g_object_unref (conn->priv->socket);
        conn->priv->socket = NULL;
        g_signal_emit (conn, signals[DISCONNECTED], 0);
@@ -497,6 +498,13 @@ soup_connection_last_used (SoupConnection *conn)
 }
 
 static void
+request_restarted (SoupMessage *req, gpointer conn)
+{
+       if (!soup_message_is_keepalive (req))
+               soup_connection_disconnect (conn);
+}
+
+static void
 request_done (SoupMessage *req, gpointer user_data)
 {
        SoupConnection *conn = user_data;
@@ -507,10 +515,11 @@ request_done (SoupMessage *req, gpointer user_data)
        conn->priv->last_used = time (NULL);
        conn->priv->in_use = FALSE;
 
-       g_signal_handlers_disconnect_by_func (req, request_done, conn);
-
        if (!soup_message_is_keepalive (req))
                soup_connection_disconnect (conn);
+
+       g_signal_handlers_disconnect_by_func (req, request_done, conn);
+       g_signal_handlers_disconnect_by_func (req, request_restarted, conn);
 }
 
 static void
@@ -523,6 +532,8 @@ send_request (SoupConnection *conn, SoupMessage *req)
                g_object_add_weak_pointer (G_OBJECT (req),
                                           (gpointer *)conn->priv->cur_req);
 
+               g_signal_connect (req, "restarted",
+                                 G_CALLBACK (request_restarted), conn);
                g_signal_connect (req, "finished",
                                  G_CALLBACK (request_done), conn);
        }