libsoup r1020 - in branches/libsoup-2.4: . libsoup tests



Author: danw
Date: Mon Jan  7 18:12:35 2008
New Revision: 1020
URL: http://svn.gnome.org/viewvc/libsoup?rev=1020&view=rev

Log:
	* libsoup/soup-session.c (soup_session_class_init): Change
	request_started signal to have a SoupSocket as its last parameter.

	* libsoup/soup-server.c: Fix request_* signals to all be (server,
	msg, client) rather than (server, client, msg).


Modified:
   branches/libsoup-2.4/ChangeLog
   branches/libsoup-2.4/libsoup/soup-auth-manager.c
   branches/libsoup-2.4/libsoup/soup-connection.c
   branches/libsoup-2.4/libsoup/soup-connection.h
   branches/libsoup-2.4/libsoup/soup-marshal.list
   branches/libsoup-2.4/libsoup/soup-server.c
   branches/libsoup-2.4/libsoup/soup-server.h
   branches/libsoup-2.4/libsoup/soup-session.c
   branches/libsoup-2.4/libsoup/soup-session.h
   branches/libsoup-2.4/tests/continue-test.c
   branches/libsoup-2.4/tests/server-auth-test.c

Modified: branches/libsoup-2.4/ChangeLog
==============================================================================
--- branches/libsoup-2.4/ChangeLog	(original)
+++ branches/libsoup-2.4/ChangeLog	Mon Jan  7 18:12:35 2008
@@ -1,5 +1,10 @@
 2008-01-07  Dan Winship  <danw gnome org>
 
+	* libsoup/soup-server.c: Fix request_* signals to all be (server,
+	msg, client) rather than (server, client, msg).
+
+2008-01-07  Dan Winship  <danw gnome org>
+
 	* docs/reference/porting-2.2-2.4.xml: Notes on porting from 2.2 to
 	2.4
 

Modified: branches/libsoup-2.4/libsoup/soup-auth-manager.c
==============================================================================
--- branches/libsoup-2.4/libsoup/soup-auth-manager.c	(original)
+++ branches/libsoup-2.4/libsoup/soup-auth-manager.c	Mon Jan  7 18:12:35 2008
@@ -20,7 +20,7 @@
 #include "soup-uri.h"
 
 static void session_request_started (SoupSession *session, SoupMessage *msg,
-				     gpointer data);
+				     SoupSocket *socket, gpointer data);
 
 struct SoupAuthManager {
 	SoupSession *session;
@@ -426,7 +426,7 @@
 
 static void
 session_request_started (SoupSession *session, SoupMessage *msg,
-			 gpointer data)
+			 SoupSocket *socket, gpointer data)
 {
 	SoupAuthManager *manager = data;
 	SoupAuth *auth;

Modified: branches/libsoup-2.4/libsoup/soup-connection.c
==============================================================================
--- branches/libsoup-2.4/libsoup/soup-connection.c	(original)
+++ branches/libsoup-2.4/libsoup/soup-connection.c	Mon Jan  7 18:12:35 2008
@@ -667,6 +667,14 @@
 	 */
 }
 
+SoupSocket *
+soup_connection_get_socket (SoupConnection *conn)
+{
+	g_return_val_if_fail (SOUP_IS_CONNECTION (conn), NULL);
+
+	return SOUP_CONNECTION_GET_PRIVATE (conn)->socket;
+}
+
 /**
  * soup_connection_is_in_use:
  * @conn: a connection

Modified: branches/libsoup-2.4/libsoup/soup-connection.h
==============================================================================
--- branches/libsoup-2.4/libsoup/soup-connection.h	(original)
+++ branches/libsoup-2.4/libsoup/soup-connection.h	Mon Jan  7 18:12:35 2008
@@ -64,6 +64,8 @@
 
 void            soup_connection_disconnect     (SoupConnection   *conn);
 
+SoupSocket     *soup_connection_get_socket     (SoupConnection   *conn);
+
 gboolean        soup_connection_is_in_use      (SoupConnection   *conn);
 time_t          soup_connection_last_used      (SoupConnection   *conn);
 

Modified: branches/libsoup-2.4/libsoup/soup-marshal.list
==============================================================================
--- branches/libsoup-2.4/libsoup/soup-marshal.list	(original)
+++ branches/libsoup-2.4/libsoup/soup-marshal.list	Mon Jan  7 18:12:35 2008
@@ -2,5 +2,6 @@
 NONE:INT
 NONE:NONE
 NONE:OBJECT
+NONE:OBJECT,OBJECT
+NONE:OBJECT,POINTER
 NONE:OBJECT,OBJECT,BOOLEAN
-NONE:POINTER,OBJECT

Modified: branches/libsoup-2.4/libsoup/soup-server.c
==============================================================================
--- branches/libsoup-2.4/libsoup/soup-server.c	(original)
+++ branches/libsoup-2.4/libsoup/soup-server.c	Mon Jan  7 18:12:35 2008
@@ -204,8 +204,8 @@
 	/**
 	 * SoupServer::request-started
 	 * @server: the server
-	 * @client: the client context
 	 * @message: the new message
+	 * @client: the client context
 	 *
 	 * Emitted when the server has started reading a new request.
 	 * @message will be completely blank; not even the
@@ -225,16 +225,16 @@
 			      G_SIGNAL_RUN_FIRST,
 			      G_STRUCT_OFFSET (SoupServerClass, request_started),
 			      NULL, NULL,
-			      soup_marshal_NONE__POINTER_OBJECT,
-			      G_TYPE_NONE, 2,
-			      SOUP_TYPE_CLIENT_CONTEXT,
-			      SOUP_TYPE_MESSAGE);
+			      soup_marshal_NONE__OBJECT_POINTER,
+			      G_TYPE_NONE, 2, 
+			      SOUP_TYPE_MESSAGE,
+			      SOUP_TYPE_CLIENT_CONTEXT);
 
 	/**
 	 * SoupServer::request-read
 	 * @server: the server
-	 * @client: the client context
 	 * @message: the message
+	 * @client: the client context
 	 *
 	 * Emitted when the server has successfully read a request.
 	 * @message will have all of its request-side information
@@ -250,16 +250,16 @@
 			      G_SIGNAL_RUN_FIRST,
 			      G_STRUCT_OFFSET (SoupServerClass, request_read),
 			      NULL, NULL,
-			      soup_marshal_NONE__POINTER_OBJECT,
+			      soup_marshal_NONE__OBJECT_POINTER,
 			      G_TYPE_NONE, 2,
-			      SOUP_TYPE_CLIENT_CONTEXT,
-			      SOUP_TYPE_MESSAGE);
+			      SOUP_TYPE_MESSAGE,
+			      SOUP_TYPE_CLIENT_CONTEXT);
 
 	/**
 	 * SoupServer::request-finished
 	 * @server: the server
-	 * @client: the client context
 	 * @message: the message
+	 * @client: the client context
 	 *
 	 * Emitted when the server has finished writing a response to
 	 * a request.
@@ -270,16 +270,16 @@
 			      G_SIGNAL_RUN_FIRST,
 			      G_STRUCT_OFFSET (SoupServerClass, request_finished),
 			      NULL, NULL,
-			      soup_marshal_NONE__POINTER_OBJECT,
+			      soup_marshal_NONE__OBJECT_POINTER,
 			      G_TYPE_NONE, 2,
-			      SOUP_TYPE_CLIENT_CONTEXT,
-			      SOUP_TYPE_MESSAGE);
+			      SOUP_TYPE_MESSAGE,
+			      SOUP_TYPE_CLIENT_CONTEXT);
 
 	/**
 	 * SoupServer::request-aborted
 	 * @server: the server
-	 * @client: the client context
 	 * @message: the message
+	 * @client: the client context
 	 *
 	 * Emitted when processing has failed for a message; this
 	 * could mean either that it could not be read (if
@@ -299,10 +299,10 @@
 			      G_SIGNAL_RUN_FIRST,
 			      G_STRUCT_OFFSET (SoupServerClass, request_aborted),
 			      NULL, NULL,
-			      soup_marshal_NONE__POINTER_OBJECT,
+			      soup_marshal_NONE__OBJECT_POINTER,
 			      G_TYPE_NONE, 2,
-			      SOUP_TYPE_CLIENT_CONTEXT,
-			      SOUP_TYPE_MESSAGE);
+			      SOUP_TYPE_MESSAGE,
+			      SOUP_TYPE_CLIENT_CONTEXT);
 
 	/* properties */
 	g_object_class_install_property (
@@ -574,7 +574,7 @@
 	g_signal_emit (server,
 		       msg->status_code == SOUP_STATUS_IO_ERROR ?
 		       signals[REQUEST_ABORTED] : signals[REQUEST_FINISHED],
-		       0, client, msg);
+		       0, msg, client);
 
 	soup_client_context_cleanup (client);
 	if (soup_socket_is_connected (sock) && soup_message_is_keepalive (msg)) {
@@ -715,7 +715,7 @@
 	g_signal_connect (msg, "finished", G_CALLBACK (request_finished), client);
 
 	g_signal_emit (server, signals[REQUEST_STARTED], 0,
-		       client, msg);
+		       msg, client);
 
 	g_object_ref (client->sock);
 	soup_message_read_request (msg, client->sock);

Modified: branches/libsoup-2.4/libsoup/soup-server.h
==============================================================================
--- branches/libsoup-2.4/libsoup/soup-server.h	(original)
+++ branches/libsoup-2.4/libsoup/soup-server.h	Mon Jan  7 18:12:35 2008
@@ -18,6 +18,10 @@
 #define SOUP_IS_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), SOUP_TYPE_SERVER))
 #define SOUP_SERVER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_SERVER, SoupServerClass))
 
+typedef struct SoupClientContext SoupClientContext;
+GType soup_client_context_get_type (void);
+#define SOUP_TYPE_CLIENT_CONTEXT (soup_client_context_get_type ())
+
 struct SoupServer {
 	GObject parent;
 
@@ -27,19 +31,15 @@
 	GObjectClass parent_class;
 
 	/* signals */
-	void (*request_started)  (SoupServer *, SoupSocket *, SoupMessage *);
-	void (*request_read)     (SoupServer *, SoupSocket *, SoupMessage *);
-	void (*request_finished) (SoupServer *, SoupSocket *, SoupMessage *);
-	void (*request_aborted)  (SoupServer *, SoupSocket *, SoupMessage *);
+	void (*request_started)  (SoupServer *, SoupMessage *, SoupClientContext *);
+	void (*request_read)     (SoupServer *, SoupMessage *, SoupClientContext *);
+	void (*request_finished) (SoupServer *, SoupMessage *, SoupClientContext *);
+	void (*request_aborted)  (SoupServer *, SoupMessage *, SoupClientContext *);
 
 } SoupServerClass;
 
 GType soup_server_get_type (void);
 
-typedef struct SoupClientContext SoupClientContext;
-GType soup_client_context_get_type (void);
-#define SOUP_TYPE_CLIENT_CONTEXT (soup_client_context_get_type ())
-
 typedef void (*SoupServerCallback) (SoupServer        *server,
 				    SoupMessage       *msg, 
 				    const char        *path,
@@ -73,7 +73,7 @@
 void               soup_server_add_handler    (SoupServer            *server,
 					       const char            *path,
 					       SoupServerCallback     callback,
-					       gpointer               data,
+					       gpointer               user_data,
 					       GDestroyNotify         destroy);
 void               soup_server_remove_handler (SoupServer            *server,
 					       const char            *path);

Modified: branches/libsoup-2.4/libsoup/soup-session.c
==============================================================================
--- branches/libsoup-2.4/libsoup/soup-session.c	(original)
+++ branches/libsoup-2.4/libsoup/soup-session.c	Mon Jan  7 18:12:35 2008
@@ -24,6 +24,7 @@
 #include "soup-message-queue.h"
 #include "soup-session.h"
 #include "soup-session-private.h"
+#include "soup-socket.h"
 #include "soup-ssl.h"
 #include "soup-uri.h"
 
@@ -228,6 +229,7 @@
 	 * SoupSession::request-started:
 	 * @session: the session
 	 * @msg: the request being sent
+	 * @socket: the socket the request is being sent on
 	 *
 	 * Emitted just before a request is sent.
 	 **/
@@ -237,9 +239,10 @@
 			      G_SIGNAL_RUN_FIRST,
 			      G_STRUCT_OFFSET (SoupSessionClass, request_started),
 			      NULL, NULL,
-			      soup_marshal_NONE__OBJECT,
-			      G_TYPE_NONE, 1,
-			      SOUP_TYPE_MESSAGE);
+			      soup_marshal_NONE__OBJECT_OBJECT,
+			      G_TYPE_NONE, 2,
+			      SOUP_TYPE_MESSAGE,
+			      SOUP_TYPE_SOCKET);
 
 	/**
 	 * SoupSession::authenticate:
@@ -577,7 +580,8 @@
 {
 	SoupSession *session = data;
 
-	g_signal_emit (session, signals[REQUEST_STARTED], 0, msg);
+	g_signal_emit (session, signals[REQUEST_STARTED], 0,
+		       msg, soup_connection_get_socket (conn));
 }
 
 static void

Modified: branches/libsoup-2.4/libsoup/soup-session.h
==============================================================================
--- branches/libsoup-2.4/libsoup/soup-session.h	(original)
+++ branches/libsoup-2.4/libsoup/soup-session.h	Mon Jan  7 18:12:35 2008
@@ -31,7 +31,7 @@
 	GObjectClass parent_class;
 
 	/* signals */
-	void (*request_started) (SoupSession *, SoupMessage *);
+	void (*request_started) (SoupSession *, SoupMessage *, SoupSocket *);
 	void (*authenticate)    (SoupSession *, SoupMessage *,
 				 SoupAuth *, gboolean);
 

Modified: branches/libsoup-2.4/tests/continue-test.c
==============================================================================
--- branches/libsoup-2.4/tests/continue-test.c	(original)
+++ branches/libsoup-2.4/tests/continue-test.c	Mon Jan  7 18:12:35 2008
@@ -388,8 +388,8 @@
 }	
 
 static void
-request_started (SoupServer *server, SoupSocket *sock,
-		 SoupMessage *msg, gpointer user_data)
+request_started (SoupServer *server, SoupMessage *msg,
+		 SoupClientContext *client, gpointer user_data)
 {
 	g_signal_connect (msg, "got_headers",
 			  G_CALLBACK (server_got_headers), server);

Modified: branches/libsoup-2.4/tests/server-auth-test.c
==============================================================================
--- branches/libsoup-2.4/tests/server-auth-test.c	(original)
+++ branches/libsoup-2.4/tests/server-auth-test.c	Mon Jan  7 18:12:35 2008
@@ -297,8 +297,8 @@
 }
 
 static void
-request_started_callback (SoupServer *server, SoupSocket *sock,
-			  SoupMessage *msg, gpointer data)
+request_started_callback (SoupServer *server, SoupMessage *msg,
+			  SoupClientContext *client, gpointer data)
 {
 	g_signal_connect (msg, "got_headers",
 			  G_CALLBACK (got_headers_callback), NULL);



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