UrlProtocolHttp: parse received cookies
* We didn't do anything with cookies received from the server, they are now automatically added to the cookie jar. * Also make sure the UrlContext (which holds the cookie jar) is forwarded from UrlRequest to UrlProtocol when it gets set. this gets cookies working in Service Kit-based WebKit.
This commit is contained in:
@@ -508,6 +508,10 @@ BUrlProtocolHttp::_MakeRequest()
|
|||||||
if ((fContext != NULL) && fHeaders.HasHeader("Set-Cookie")) {
|
if ((fContext != NULL) && fHeaders.HasHeader("Set-Cookie")) {
|
||||||
for (int32 i = 0; i < fHeaders.CountHeaders(); i++) {
|
for (int32 i = 0; i < fHeaders.CountHeaders(); i++) {
|
||||||
if (fHeaders.HeaderAt(i).NameIs("Set-Cookie")) {
|
if (fHeaders.HeaderAt(i).NameIs("Set-Cookie")) {
|
||||||
|
BNetworkCookie* cookie = new BNetworkCookie();
|
||||||
|
cookie->ParseCookieStringFromUrl(
|
||||||
|
fHeaders.HeaderAt(i).Value(), fUrl);
|
||||||
|
fContext->GetCookieJar().AddCookie(cookie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,6 +69,9 @@ void
|
|||||||
BUrlRequest::SetContext(BUrlContext* context)
|
BUrlRequest::SetContext(BUrlContext* context)
|
||||||
{
|
{
|
||||||
fContext = context;
|
fContext = context;
|
||||||
|
|
||||||
|
if (fUrlProtocol != NULL)
|
||||||
|
fUrlProtocol->SetContext(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user