libsoup r1043 - in trunk: . libsoup



Author: danw
Date: Tue Jan 15 22:52:36 2008
New Revision: 1043
URL: http://svn.gnome.org/viewvc/libsoup?rev=1043&view=rev

Log:
	* libsoup/soup-auth-manager-ntlm.c: Replaces SoupConnectionNTLM;
	now works as a SoupSession::request_started watcher.

	* libsoup/soup-connection.c: remove the no-longer-needed
	"authenticate" signal

	* libsoup/soup-session.c: Use a SoupAuthManagerNTLM if USE_NTLM is
	set. Remove connection-authenticate-signal references.


Added:
   trunk/libsoup/soup-auth-manager-ntlm.c
      - copied unchanged from r1042, /branches/libsoup-2.4/libsoup/soup-auth-manager-ntlm.c
   trunk/libsoup/soup-auth-manager-ntlm.h
      - copied unchanged from r1042, /branches/libsoup-2.4/libsoup/soup-auth-manager-ntlm.h
Removed:
   trunk/libsoup/soup-connection-ntlm.c
   trunk/libsoup/soup-connection-ntlm.h
Modified:
   trunk/ChangeLog
   trunk/libsoup/Makefile.am
   trunk/libsoup/soup-connection.c
   trunk/libsoup/soup-connection.h
   trunk/libsoup/soup-session.c

Modified: trunk/libsoup/Makefile.am
==============================================================================
--- trunk/libsoup/Makefile.am	(original)
+++ trunk/libsoup/Makefile.am	Tue Jan 15 22:52:36 2008
@@ -105,10 +105,10 @@
 	soup-auth-domain-digest.c	\
 	soup-auth-manager.h		\
 	soup-auth-manager.c		\
+	soup-auth-manager-ntlm.h	\
+	soup-auth-manager-ntlm.c	\
 	soup-connection.h		\
 	soup-connection.c		\
-	soup-connection-ntlm.h		\
-	soup-connection-ntlm.c		\
 	soup-date.c			\
 	soup-enum-types.c		\
 	soup-dns.h			\

Modified: trunk/libsoup/soup-connection.c
==============================================================================
--- trunk/libsoup/soup-connection.c	(original)
+++ trunk/libsoup/soup-connection.c	Tue Jan 15 22:52:36 2008
@@ -62,7 +62,6 @@
 	CONNECT_RESULT,
 	DISCONNECTED,
 	REQUEST_STARTED,
-	AUTHENTICATE,
 	LAST_SIGNAL
 };
 
@@ -166,17 +165,6 @@
 			      soup_marshal_NONE__OBJECT,
 			      G_TYPE_NONE, 1,
 			      SOUP_TYPE_MESSAGE);
-	signals[AUTHENTICATE] =
-		g_signal_new ("authenticate",
-			      G_OBJECT_CLASS_TYPE (object_class),
-			      G_SIGNAL_RUN_FIRST,
-			      G_STRUCT_OFFSET (SoupConnectionClass, authenticate),
-			      NULL, NULL,
-			      soup_marshal_NONE__OBJECT_OBJECT_BOOLEAN,
-			      G_TYPE_NONE, 3,
-			      SOUP_TYPE_MESSAGE,
-			      SOUP_TYPE_AUTH,
-			      G_TYPE_BOOLEAN);
 
 	/* properties */
 	g_object_class_install_property (
@@ -776,20 +764,3 @@
 
 	clear_current_request (conn);
 }
-
-/**
- * soup_connection_authenticate:
- * @conn: a #SoupConnection
- * @msg: the message to authenticate
- * @auth: the #SoupAuth to authenticate
- * @retrying: %TRUE if this is the second or later try
- *
- * Emits the %authenticate signal on @conn. For use by #SoupConnection
- * subclasses.
- **/
-void
-soup_connection_authenticate (SoupConnection *conn, SoupMessage *msg,
-			      SoupAuth *auth, gboolean retrying)
-{
-	g_signal_emit (conn, signals[AUTHENTICATE], 0, msg, auth, retrying);
-}

Modified: trunk/libsoup/soup-connection.h
==============================================================================
--- trunk/libsoup/soup-connection.h	(original)
+++ trunk/libsoup/soup-connection.h	Tue Jan 15 22:52:36 2008
@@ -33,9 +33,6 @@
 
 	void (*request_started) (SoupConnection *, SoupMessage *);
 
-	void (*authenticate)    (SoupConnection *, SoupMessage *,
-				 SoupAuth *, gboolean);
-
 	/* methods */
 	void (*send_request) (SoupConnection *, SoupMessage *);
 } SoupConnectionClass;
@@ -75,12 +72,6 @@
 void            soup_connection_reserve        (SoupConnection   *conn);
 void            soup_connection_release        (SoupConnection   *conn);
 
-/* protected */
-void            soup_connection_authenticate   (SoupConnection   *conn,
-						SoupMessage      *msg,
-						SoupAuth         *auth,
-						gboolean          retrying);
-
 G_END_DECLS
 
 #endif /* SOUP_CONNECTION_H */

Modified: trunk/libsoup/soup-session.c
==============================================================================
--- trunk/libsoup/soup-session.c	(original)
+++ trunk/libsoup/soup-session.c	Tue Jan 15 22:52:36 2008
@@ -17,8 +17,8 @@
 #include "soup-auth-basic.h"
 #include "soup-auth-digest.h"
 #include "soup-auth-manager.h"
+#include "soup-auth-manager-ntlm.h"
 #include "soup-connection.h"
-#include "soup-connection-ntlm.h"
 #include "soup-marshal.h"
 #include "soup-message-private.h"
 #include "soup-message-queue.h"
@@ -49,7 +49,6 @@
 	SoupAuth *proxy_auth;
 
 	guint max_conns, max_conns_per_host;
-	gboolean use_ntlm;
 
 	char *ssl_ca_file;
 	SoupSSLCredentials *ssl_creds;
@@ -57,6 +56,7 @@
 	SoupMessageQueue *queue;
 
 	SoupAuthManager *auth_manager;
+	SoupAuthManagerNTLM *ntlm_manager;
 
 	GHashTable *hosts; /* SoupURI -> SoupSessionHost */
 	GHashTable *conns; /* SoupConnection -> SoupSessionHost */
@@ -385,7 +385,15 @@
 		priv->max_conns_per_host = g_value_get_int (value);
 		break;
 	case PROP_USE_NTLM:
-		priv->use_ntlm = g_value_get_boolean (value);
+		if (g_value_get_boolean (value)) {
+			if (!priv->ntlm_manager)
+				priv->ntlm_manager = soup_auth_manager_ntlm_new (session);
+		} else {
+			if (priv->ntlm_manager) {
+				soup_auth_manager_ntlm_free (priv->ntlm_manager);
+				priv->ntlm_manager = NULL;
+			}
+		}
 		break;
 	case PROP_SSL_CA_FILE:
 		new_ca_file = g_value_get_string (value);
@@ -437,7 +445,7 @@
 		g_value_set_int (value, priv->max_conns_per_host);
 		break;
 	case PROP_USE_NTLM:
-		g_value_set_boolean (value, priv->use_ntlm);
+		g_value_set_boolean (value, priv->ntlm_manager != NULL);
 		break;
 	case PROP_SSL_CA_FILE:
 		g_value_set_string (value, priv->ssl_ca_file);
@@ -538,13 +546,6 @@
 }
 
 static void
-reemit_authenticate (SoupConnection *conn, SoupMessage *msg,
-		     SoupAuth *auth, gboolean retrying, gpointer session)
-{
-	soup_session_emit_authenticate (session, msg, auth, retrying);
-}
-
-static void
 redirect_handler (SoupMessage *msg, gpointer user_data)
 {
 	SoupSession *session = user_data;
@@ -796,9 +797,7 @@
 		return NULL;
 	}
 
-	conn = g_object_new (
-		(priv->use_ntlm ?
-		 SOUP_TYPE_CONNECTION_NTLM : SOUP_TYPE_CONNECTION),
+	conn = soup_connection_new (
 		SOUP_CONNECTION_ORIGIN_URI, host->root_uri,
 		SOUP_CONNECTION_PROXY_URI, priv->proxy_uri,
 		SOUP_CONNECTION_SSL_CREDENTIALS, priv->ssl_creds,
@@ -814,9 +813,6 @@
 	g_signal_connect (conn, "request_started",
 			  G_CALLBACK (connection_started_request),
 			  session);
-	g_signal_connect (conn, "authenticate",
-			  G_CALLBACK (reemit_authenticate),
-			  session);
 
 	g_hash_table_insert (priv->conns, conn, host);
 



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