[webkit-gtk] NetworkRequest and NetworkResponse in WebKit2 API

Carlos Garcia Campos cgarcia at igalia.com
Tue Nov 15 08:17:45 PST 2011

El mar, 15-11-2011 a las 09:15 -0500, Dan Winship escribió:
> On 11/15/2011 05:46 AM, Sergio Villar Senin wrote:
> > En 15/11/11 11:08, Carlos Garcia Campos escribiu:
> >> I'm currently working on downloads API for WebKit2 and I need to expose
> >> NetworkResponse which is not wrapped in WebKit2 API yet. In WebKit1 we
> >> have WebKitNetworkRequest and WebKitNetworkResponse, which are mostly
> >> the same because a SoupMessage represents both a request and response.
> >> So, both NetworkRequest and NetworkResponse are just a URI and a
> >> SoupMessage. Thinking about how to expose them in WebKit2 API several
> >> ideas came to my mind:
> > 
> > In general I'd avoid exposing the SoupMessage basically because ideally
> > we will not need it in the future as it would become just an
> > implementation detail of the new libsoup stream API.
> I think SoupMessage will still be around... we need somewhere to store
> all the parsed information (headers, etc). (Although I guess we could
> just add methods to SoupRequestHTTP?)
> But anyway, SoupMessage only exists for HTTP anyway; you should expose
> the SoupRequest object instead so the API works for other types too. And
> if it's a SoupRequestHTTP then the caller can get the SoupMessage from
> that. (Maybe there could be a WebKitNetworkRequest/Response helper
> method to get the SoupMessage directly too I guess.)

The thing is that in WebKit2 we only have the information in the UI
process, the network stuff happens in the Web process, so even if you
could do something like:

WebKitNetworkRequest *request = webkit_network_request_new_for_message (soup_message);
webkit_web_view_load_request(web_view, request);

you couldn't connect to SoupMessage signals like "got-headers" to
monitor the message, because the data is passed to the Web process where
a new soup message is created. That's why I prefer not to expose
SoupMessage in the API, it would be confusing and in most of the cases
(if not all) the message is used only to get information such as headers
or flags. 

Carlos Garcia Campos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.webkit.org/pipermail/webkit-gtk/attachments/20111115/5cd06a27/attachment.bin>

More information about the webkit-gtk mailing list