title: Webkit GTK : Getting HTTP response
body: <p>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.</p>
  
  <p>Webkit GTK uses the <strong><a href="http://developer.gnome.org/libsoup/stable/" rel="nofollow">Soup API</a></strong> for HTTP networking, and according to the <a href="http://webkitgtk.org/reference/webkitgtk/stable/webkitgtk-webkitwebview.html" rel="nofollow">documentation</a>, there seem to be two relevant signals: <code>"resource-request-starting"</code> and <code>"resource-response-received"</code>.</p>
  
  <p>So, I tried connecting a signal for <code>"resource-request-starting"</code>:</p>
  
  <pre><code>g_signal_connect(web_view, "resource-request-starting", G_CALLBACK(resource_request_starting_callback), 0);
  </code></pre>
  
  <p>...and it works.  Within the callback handler I can get access to the underlying <code>SoupMessage</code> object which gives me information about the HTTP request.</p>
  
  <p><br>
  So that gets me the HTTP <em>request</em>, BUT... when I try to get the actual HTTP <em>response</em>, I run into trouble.  I tried listening for the <code>"resource-response-received"</code> signal:</p>
  
  <pre><code>g_signal_connect(web_view, "resource-response-received", G_CALLBACK(resource_response_received_callback), 0);
  </code></pre>
  
  <p>This causes GTK to emit a warning: </p>
  
  <pre><code>GLib-GObject-WARNING **: /build/buildd/glib2.0-2.30.0/./gobject/gsignal.c:2295: signal `resource-response-received' is invalid for instance `0x2b46c00'
  </code></pre>
  
  <p>Googling around for <code>resource-response-received</code>, I find almost no information at all about this signal.  The <a href="http://webkitgtk.org/reference/webkitgtk/stable/webkitgtk-webkitwebview.html#WebKitWebView-resource-response-received" rel="nofollow">documentation claims</a> it does what I want, but in practice it doesn't actually work.</p>
  
  <p>So, I don't know if I'm going about this the wrong way.  But in general, can anyone provide an example of how you can get an actual HTTP status code (like 200, 404, etc.) for a page load using Webkit GTK?</p>