I've been trying for a while to figure out how to use the Webkit GTK API to get an HTTP response code for a particular page-load.

According to the documentation, there seem to be two relevant signals: "resource-request-starting" and "resource-response-received", both of which provide you with access to a SoupMessage object that contains the HTTP information.

So, I tried connecting a signal for "resource-request-starting":

g_signal_connect(web_view, "resource-request-starting", G_CALLBACK(resource_request_starting_callback), 0);

...and it works nicely. Within the callback function I can get access to the underlying SoupMessage object which gives me information about the HTTP request.


BUT... when I try to get the actual HTTP response, I run into trouble. I tried listening for the "resource-response-received" signal:

g_signal_connect(web_view, "resource-response-received", G_CALLBACK(resource_request_starting_callback), 0);

This causes GLib to emit a warning:

GLib-GObject-WARNING **: /build/buildd/glib2.0-2.30.0/./gobject/gsignal.c:2295: signal `resource-response-received' is invalid for instance `0x2b46c00'

Googling around for "resource-response-received", I find almost no information at all about this signal. The documentation seems to indicate it does what I want, but in practice it doesn't actually work.

So, I don't know if I'm going about this the wrong way. But in general, what is the best way to get an HTTP status code (like 200, 404, etc.) for a page load using Webkit GTK?

_______________________________________________
webkit-gtk mailing list
webkit-gtk@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-gtk

Reply via email to