Re: access log



On 08/05/2009 10:03 AM, "J. David Ibáñez" wrote:
> The 'request-finished' signal in particular, which in theory gives
> the required information: the message and the client context.  The
> problem is the client context is always NULL, so I cannot get the
> client address.

Hm? That can't be right. soup-server.c does:

	SoupServer *server = client->server;
	SoupSocket *sock = client->sock;

	g_signal_emit (server,
		       msg->status_code == SOUP_STATUS_IO_ERROR ?
		       signals[REQUEST_ABORTED] : signals[REQUEST_FINISHED],
		       0, msg, client);

So if client was NULL it would crash before emitting the signal.

Are you sure you've got the signal handler arguments right?

> Is this a bug? Is there a better way to implement an access log?

request-finished sounds right to me. (Though, as pointed out by the code
quoted above, you'll need to catch request-aborted too if you want to
log requests where the client disconnects part-way through.)

FWIW, I've just pushed a "server-feature" branch to libsoup git, which
adds SoupServerFeature along the lines of SoupSessionFeature, and adds
support to SoupLogger for logging server-side requests as well. But it
does it by connecting to request-started, and then watching SoupMessage
signals from that point. But connecting to request-finished *should* work...

-- Dan


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