[webkit-help] WebView willSendRequest: for WebSocket Handshake

Leo Franchi lfranchi at kde.org
Mon Nov 18 11:46:18 PST 2013


Hello folks,

I'm embedding a WebView in my Cocoa application and using 
`WebResourceLoadDelegate` 
`webView:willSendRequest:redirectResponse:fromDataSource`. Specifically, 
I have an app that uses a WebView that I'd like to isolate cookie-wise 
from the system Safari/Webkit.

So far so good, I have code in `willSendRequest` that populates outgoing 
requests with cookies captured from 
`webView:resource:didReceiveResponse`. That seems to be working fine.

The issue I have is that when making a new WebSocket connection in JS, 
something like:

`new WebSocket('wss://www.foo.com')`

there is no corresponding call to `willSendRequest:` for the initial 
HTTP-part of the Upgrade request. This is an issue for me since it means 
I can't add my cookies to the request... I imagine somewhere internally 
in WebKit there's an NSURLRequest being created for this HTTP request 
but it's not getting passed through `willSendRequest` as for other XHRs 
of load requests from JS.

Does anyone have any ideas / pointers? I've been unable to figure out if 
there's any way for me to attach the proper cookies to this initial 
handshake.

cheers,
leo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20131118/0a64271a/attachment.html>


More information about the webkit-help mailing list