diff options
Diffstat (limited to 'WebCore/platform/network')
4 files changed, 66 insertions, 28 deletions
diff --git a/WebCore/platform/network/brew/DNSBrew.cpp b/WebCore/platform/network/brew/DNSBrew.cpp new file mode 100644 index 0000000..ed1767a --- /dev/null +++ b/WebCore/platform/network/brew/DNSBrew.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2010 Company 100, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "DNS.h" + +#include "NotImplemented.h" + +namespace WebCore { + +void prefetchDNS(const String& hostname) +{ + // DNS prefetching is not implemented because the maximum number of UDP + // sockets is quite small in most BREW devices. + notImplemented(); +} + +} diff --git a/WebCore/platform/network/chromium/CookieJarChromium.cpp b/WebCore/platform/network/chromium/CookieJarChromium.cpp index 41cf331..e17816a 100644 --- a/WebCore/platform/network/chromium/CookieJarChromium.cpp +++ b/WebCore/platform/network/chromium/CookieJarChromium.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Google Inc. All rights reserved. + * Copyright (c) 2010, Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -39,46 +39,32 @@ namespace WebCore { void setCookies(Document* document, const KURL& url, const String& value) { - ChromiumBridge::setCookies(url, document->firstPartyForCookies(), value); + ChromiumBridge::setCookies(document, url, value); } String cookies(const Document* document, const KURL& url) { - return ChromiumBridge::cookies(url, document->firstPartyForCookies()); + return ChromiumBridge::cookies(document, url); } String cookieRequestHeaderFieldValue(const Document* document, const KURL& url) { - // FIXME: move in ChromiumBridge? - Vector<Cookie> cookies; - getRawCookies(document, url, cookies); - String cookieLine; - // FIXME: Set $Version=v; - for (size_t i = 0; i < cookies.size(); i++) { - Cookie cookie = cookies[i]; - if (i > 0) - cookieLine += "; "; - if (!cookie.name.isEmpty()) - cookieLine += cookie.name + "="; - cookieLine += cookie.value; - // FIXME: set $Path, $Domain, ... - } - return cookieLine; + return ChromiumBridge::cookieRequestHeaderFieldValue(document, url); } bool cookiesEnabled(const Document* document) { - return ChromiumBridge::cookiesEnabled(document->cookieURL(), document->firstPartyForCookies()); + return ChromiumBridge::cookiesEnabled(document); } bool getRawCookies(const Document* document, const KURL& url, Vector<Cookie>& rawCookies) { - return ChromiumBridge::rawCookies(url, document->firstPartyForCookies(), &rawCookies); + return ChromiumBridge::rawCookies(document, url, rawCookies); } -void deleteCookie(const Document*, const KURL& url, const String& cookieName) +void deleteCookie(const Document* document, const KURL& url, const String& cookieName) { - return ChromiumBridge::deleteCookie(url, cookieName); + return ChromiumBridge::deleteCookie(document, url, cookieName); } } // namespace WebCore diff --git a/WebCore/platform/network/chromium/ResourceRequest.cpp b/WebCore/platform/network/chromium/ResourceRequest.cpp index 5b27c1b..016bd34 100644 --- a/WebCore/platform/network/chromium/ResourceRequest.cpp +++ b/WebCore/platform/network/chromium/ResourceRequest.cpp @@ -31,7 +31,10 @@ namespace WebCore { // This is used by the loader to control the number of issued parallel load requests. unsigned initializeMaximumHTTPConnectionCountPerHost() { - return 6; + // The chromium network stack already handles limiting the number of + // parallel requests per host, so there's no need to do it here. Therefore, + // this is set to a high value that should never be hit in practice. + return 10000; } } // namespace WebCore diff --git a/WebCore/platform/network/soup/ResourceHandleSoup.cpp b/WebCore/platform/network/soup/ResourceHandleSoup.cpp index ee8e7aa..4c59d34 100644 --- a/WebCore/platform/network/soup/ResourceHandleSoup.cpp +++ b/WebCore/platform/network/soup/ResourceHandleSoup.cpp @@ -380,6 +380,7 @@ static gboolean parseDataUrl(gpointer callback_data) String charset = extractCharsetFromMediaType(mediaType); ResourceResponse response; + response.setURL(handle->request().url()); response.setMimeType(mimeType); if (isBase64) { @@ -387,7 +388,10 @@ static gboolean parseDataUrl(gpointer callback_data) response.setTextEncodingName(charset); client->didReceiveResponse(handle, response); - if (d->m_cancelled) + // The load may be cancelled, and the client may be destroyed + // by any of the client reporting calls, so we check, and bail + // out in either of those cases. + if (!handle->client() || d->m_cancelled) return false; // Use the GLib Base64, since WebCore's decoder isn't @@ -404,16 +408,16 @@ static gboolean parseDataUrl(gpointer callback_data) response.setTextEncodingName("UTF-16"); client->didReceiveResponse(handle, response); - if (d->m_cancelled) + if (!handle->client() || d->m_cancelled) return false; if (data.length() > 0) client->didReceiveData(handle, reinterpret_cast<const char*>(data.characters()), data.length() * sizeof(UChar), 0); - - if (d->m_cancelled) - return false; } + if (!handle->client() || d->m_cancelled) + return false; + client->didFinishLoading(handle); return false; @@ -565,6 +569,11 @@ static bool startHttp(ResourceHandle* handle) // balanced by a deref() in finishedCallback, which should always run handle->ref(); + // Make sure we have an Accept header for subresources; some sites + // want this to serve some of their subresources + if (!soup_message_headers_get_one(d->m_msg->request_headers, "Accept")) + soup_message_headers_append(d->m_msg->request_headers, "Accept", "*/*"); + // Balanced in ResourceHandleInternal's destructor; we need to // keep our own ref, because after queueing the message, the // session owns the initial reference. |