[webkit-help] WebView willSendRequest: for WebSocket Handshake

Leo Franchi lfranchi at kde.org
Tue Nov 19 07:32:34 PST 2013


Thanks for the helpful/detailed response. I've opened 
https://bugs.webkit.org/show_bug.cgi?id=124580. Meanwhile I may try 
uglier hacks to get this to work for my own purposes :)

cheers,
leo

On 18 Nov 2013, at 17:07, Alexey Proskuryakov wrote:

> This is not necessarily the case - Inspector support for WebSockets 
> does not require exposing a public API for them. An API needs to be 
> tracked in a separate bug (and then it will possibly be a new one, not 
> a reuse of willSendRequest).
>
> There is no NSURLRequest created for WebSocket requests, the HTTP 
> header is built as a character buffer in 
> WebSocketHandshake::clientHandshakeMessage().
>
> - WBR, Alexey Proskuryakov
>
>
> 18 нояб. 2013 г., в 13:52, Leo Franchi <lfranchi at kde.org> 
> написал(а):
>
>> Hello Alexey,
>>
>> Thanks for the quick response. After doing some more searching I 
>> guess this is covered by 
>> https://bugs.webkit.org/show_bug.cgi?id=34565 (when this is 
>> implemented, as mentioned in a comment, going through 
>> WebCore::InspectorController / willSendRequest etc should come as 
>> well.
>>
>> For now I will simply stop attempting to use a private cookie jar for 
>> my app---I have yet to dig into webkit enough to see where the 
>> cookies are added to the NSURLRequest that is being created.
>>
>> cheers,
>> leo
>>
>> On 18 Nov 2013, at 15:43, Alexey Proskuryakov wrote:
>>
>>> Hi Leo,
>>>
>>> This is not currently supported. Please file a bug via 
>>> bugs.webkit.org.
>>>
>>> - WBR, Alexey Proskuryakov
>>>
>>> 18 нояб. 2013 г., в 11:46, Leo Franchi <lfranchi at kde.org> 
>>> написал(а):
>>>
>>>> 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
>>>>
>>>> _______________________________________________
>>>> webkit-help mailing list
>>>> webkit-help at lists.webkit.org
>>>> https://lists.webkit.org/mailman/listinfo/webkit-help


More information about the webkit-help mailing list