diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
commit | 9364f22aed35e1a1e9d07c121510f80be3ab0502 (patch) | |
tree | d49911209b132da58d838efa852daf28d516df21 /WebCore/platform/network | |
parent | 87eb0cb35bad8784770ebc807e6c982432e47107 (diff) | |
download | external_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.zip external_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.tar.gz external_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.tar.bz2 |
Initial Contribution
Diffstat (limited to 'WebCore/platform/network')
43 files changed, 731 insertions, 887 deletions
diff --git a/WebCore/platform/network/AuthenticationChallengeBase.cpp b/WebCore/platform/network/AuthenticationChallenge.cpp index df80441..f7275f3 100644 --- a/WebCore/platform/network/AuthenticationChallengeBase.cpp +++ b/WebCore/platform/network/AuthenticationChallenge.cpp @@ -29,17 +29,14 @@ namespace WebCore { -AuthenticationChallengeBase::AuthenticationChallengeBase() +AuthenticationChallenge::AuthenticationChallenge() : m_isNull(true) , m_previousFailureCount(0) { } -AuthenticationChallengeBase::AuthenticationChallengeBase(const ProtectionSpace& protectionSpace, - const Credential& proposedCredential, - unsigned previousFailureCount, - const ResourceResponse& response, - const ResourceError& error) +AuthenticationChallenge::AuthenticationChallenge(const ProtectionSpace& protectionSpace, const Credential& proposedCredential, + unsigned previousFailureCount, const ResourceResponse& response, const ResourceError& error) : m_isNull(false) , m_protectionSpace(protectionSpace) , m_proposedCredential(proposedCredential) @@ -49,49 +46,62 @@ AuthenticationChallengeBase::AuthenticationChallengeBase(const ProtectionSpace& { } -unsigned AuthenticationChallengeBase::previousFailureCount() const +unsigned AuthenticationChallenge::previousFailureCount() const { return m_previousFailureCount; } -const Credential& AuthenticationChallengeBase::proposedCredential() const +const Credential& AuthenticationChallenge::proposedCredential() const { return m_proposedCredential; } -const ProtectionSpace& AuthenticationChallengeBase::protectionSpace() const +const ProtectionSpace& AuthenticationChallenge::protectionSpace() const { return m_protectionSpace; } -const ResourceResponse& AuthenticationChallengeBase::failureResponse() const +const ResourceResponse& AuthenticationChallenge::failureResponse() const { return m_failureResponse; } -const ResourceError& AuthenticationChallengeBase::error() const +const ResourceError& AuthenticationChallenge::error() const { return m_error; } -bool AuthenticationChallengeBase::isNull() const +bool AuthenticationChallenge::isNull() const { return m_isNull; } -void AuthenticationChallengeBase::nullify() +void AuthenticationChallenge::nullify() { m_isNull = true; } -bool AuthenticationChallengeBase::compare(const AuthenticationChallenge& a, const AuthenticationChallenge& b) +bool operator==(const AuthenticationChallenge& a, const AuthenticationChallenge& b) { - if (a.isNull() && b.isNull()) + if (a.isNull() != b.isNull()) + return false; + if (a.isNull()) return true; - - if (a.isNull() || b.isNull()) + +#if PLATFORM(MAC) + if (a.sender() != b.sender()) return false; + if (a.nsURLAuthenticationChallenge() != b.nsURLAuthenticationChallenge()) + return false; +#elif USE(CFNETWORK) + if (a.sourceHandle() != b.sourceHandle()) + return false; + + if (a.cfURLAuthChallengeRef() != b.cfURLAuthChallengeRef()) + return false; +#endif + if (a.protectionSpace() != b.protectionSpace()) return false; @@ -107,7 +117,14 @@ bool AuthenticationChallengeBase::compare(const AuthenticationChallenge& a, cons if (a.error() != b.error()) return false; - return AuthenticationChallenge::platformCompare(a, b); + return true; +} + +bool operator!=(const AuthenticationChallenge& a, const AuthenticationChallenge& b) +{ + return !(a == b); } } + + diff --git a/WebCore/platform/network/mac/AuthenticationChallenge.h b/WebCore/platform/network/AuthenticationChallenge.h index e8f3a2d..3e46ea4 100644 --- a/WebCore/platform/network/mac/AuthenticationChallenge.h +++ b/WebCore/platform/network/AuthenticationChallenge.h @@ -25,8 +25,15 @@ #ifndef AuthenticationChallenge_h #define AuthenticationChallenge_h -#include "AuthenticationChallengeBase.h" +#include "Credential.h" +#include "ProtectionSpace.h" +#include "ResourceResponse.h" +#include "ResourceError.h" +#include <wtf/RefPtr.h> + + +#if PLATFORM(MAC) #include <wtf/RetainPtr.h> #ifndef __OBJC__ typedef struct objc_object *id; @@ -34,26 +41,64 @@ class NSURLAuthenticationChallenge; #else @class NSURLAuthenticationChallenge; #endif +#endif + +#if USE(CFNETWORK) +typedef struct _CFURLAuthChallenge* CFURLAuthChallengeRef; +#endif + namespace WebCore { -class AuthenticationChallenge : public AuthenticationChallengeBase { +class ResourceHandle; + +class AuthenticationChallenge { + public: - AuthenticationChallenge() {} + AuthenticationChallenge(); AuthenticationChallenge(const ProtectionSpace& protectionSpace, const Credential& proposedCredential, unsigned previousFailureCount, const ResourceResponse& response, const ResourceError& error); +#if PLATFORM(MAC) AuthenticationChallenge(NSURLAuthenticationChallenge *); +#elif USE(CFNETWORK) + AuthenticationChallenge(CFURLAuthChallengeRef, ResourceHandle* sourceHandle); +#endif + unsigned previousFailureCount() const; + const Credential& proposedCredential() const; + const ProtectionSpace& protectionSpace() const; + const ResourceResponse& failureResponse() const; + const ResourceError& error() const; + + bool isNull() const; + void nullify(); + +#if PLATFORM(MAC) id sender() const { return m_sender.get(); } NSURLAuthenticationChallenge *nsURLAuthenticationChallenge() const { return m_macChallenge.get(); } - +#elif USE(CFNETWORK) + ResourceHandle* sourceHandle() const { return m_sourceHandle.get(); } + CFURLAuthChallengeRef cfURLAuthChallengeRef() const { return m_cfChallenge.get(); } +#endif private: - friend class AuthenticationChallengeBase; - static bool platformCompare(const AuthenticationChallenge& a, const AuthenticationChallenge& b); + bool m_isNull; + ProtectionSpace m_protectionSpace; + Credential m_proposedCredential; + unsigned m_previousFailureCount; + ResourceResponse m_failureResponse; + ResourceError m_error; +#if PLATFORM(MAC) RetainPtr<id> m_sender; RetainPtr<NSURLAuthenticationChallenge *> m_macChallenge; +#elif USE(CFNETWORK) + RefPtr<ResourceHandle> m_sourceHandle; + RetainPtr<CFURLAuthChallengeRef> m_cfChallenge; +#endif + }; +bool operator==(const AuthenticationChallenge&, const AuthenticationChallenge&); +bool operator!=(const AuthenticationChallenge&, const AuthenticationChallenge&); } - #endif + diff --git a/WebCore/platform/network/AuthenticationChallengeBase.h b/WebCore/platform/network/AuthenticationChallengeBase.h deleted file mode 100644 index 5810a6d..0000000 --- a/WebCore/platform/network/AuthenticationChallengeBase.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * 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 COMPUTER, INC. ``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. - */ -#ifndef AuthenticationChallengeBase_h -#define AuthenticationChallengeBase_h - -#include "Credential.h" -#include "ProtectionSpace.h" -#include "ResourceResponse.h" -#include "ResourceError.h" - -namespace WebCore { - -class AuthenticationChallenge; - -class AuthenticationChallengeBase { -public: - AuthenticationChallengeBase(); - AuthenticationChallengeBase(const ProtectionSpace& protectionSpace, const Credential& proposedCredential, unsigned previousFailureCount, const ResourceResponse& response, const ResourceError& error); - - unsigned previousFailureCount() const; - const Credential& proposedCredential() const; - const ProtectionSpace& protectionSpace() const; - const ResourceResponse& failureResponse() const; - const ResourceError& error() const; - - bool isNull() const; - void nullify(); - - static bool compare(const AuthenticationChallenge& a, const AuthenticationChallenge& b); - -protected: - // The AuthenticationChallenge subclass may "shadow" this method to compare platform specific fields - static bool platformCompare(const AuthenticationChallengeBase& a, const AuthenticationChallengeBase& b) { return true; } - - bool m_isNull; - ProtectionSpace m_protectionSpace; - Credential m_proposedCredential; - unsigned m_previousFailureCount; - ResourceResponse m_failureResponse; - ResourceError m_error; -}; - -inline bool operator==(const AuthenticationChallenge& a, const AuthenticationChallenge& b) { return AuthenticationChallengeBase::compare(a, b); } -inline bool operator!=(const AuthenticationChallenge& a, const AuthenticationChallenge& b) { return !(a == b); } - -} - -#endif diff --git a/WebCore/platform/network/FormData.cpp b/WebCore/platform/network/FormData.cpp index 3453169..ed2d811 100644 --- a/WebCore/platform/network/FormData.cpp +++ b/WebCore/platform/network/FormData.cpp @@ -25,45 +25,25 @@ namespace WebCore { -inline FormData::FormData() +FormData::FormData(const void* data, size_t size) { + appendData(data, size); } -PassRefPtr<FormData> FormData::create() +FormData::FormData(const CString& s) { - return adoptRef(new FormData); + appendData(s.data(), s.length()); } -PassRefPtr<FormData> FormData::create(const void* data, size_t size) -{ - RefPtr<FormData> result = create(); - result->appendData(data, size); - return result.release(); -} - -PassRefPtr<FormData> FormData::create(const CString& string) -{ - RefPtr<FormData> result = create(); - result->appendData(string.data(), string.length()); - return result.release(); -} - -PassRefPtr<FormData> FormData::create(const Vector<char>& vector) -{ - RefPtr<FormData> result = create(); - result->appendData(vector.data(), vector.size()); - return result.release(); -} - -inline FormData::FormData(const FormData& data) - : RefCounted<FormData>(1) +FormData::FormData(const FormData& data) + : RefCounted<FormData>() , m_elements(data.m_elements) { } PassRefPtr<FormData> FormData::copy() const { - return adoptRef(new FormData(*this)); + return new FormData(*this); } void FormData::appendData(const void* data, size_t size) diff --git a/WebCore/platform/network/FormData.h b/WebCore/platform/network/FormData.h index 168020e..c33ef52 100644 --- a/WebCore/platform/network/FormData.h +++ b/WebCore/platform/network/FormData.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2006 Apple Computer, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -59,10 +59,9 @@ inline bool operator!=(const FormDataElement& a, const FormDataElement& b) class FormData : public RefCounted<FormData> { public: - static PassRefPtr<FormData> create(); - static PassRefPtr<FormData> create(const void*, size_t); - static PassRefPtr<FormData> create(const CString&); - static PassRefPtr<FormData> create(const Vector<char>&); + FormData() { } + FormData(const void* data, size_t); + FormData(const CString&); PassRefPtr<FormData> copy() const; void appendData(const void* data, size_t); @@ -75,10 +74,9 @@ public: const Vector<FormDataElement>& elements() const { return m_elements; } private: - FormData(); - FormData(const FormData&); + FormData(const FormData&); - Vector<FormDataElement> m_elements; + Vector<FormDataElement> m_elements; }; inline bool operator==(const FormData& a, const FormData& b) diff --git a/WebCore/platform/network/HTTPParsers.cpp b/WebCore/platform/network/HTTPParsers.cpp index 0858fc9..e71be5f 100644 --- a/WebCore/platform/network/HTTPParsers.cpp +++ b/WebCore/platform/network/HTTPParsers.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) - * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -103,8 +103,7 @@ bool parseHTTPRefresh(const String& refresh, bool fromHttpEquivMeta, double& del String filenameFromHTTPContentDisposition(const String& value) { - Vector<String> keyValuePairs; - value.split(';', keyValuePairs); + Vector<String> keyValuePairs = value.split(';'); unsigned length = keyValuePairs.size(); for (unsigned i = 0; i < length; i++) { diff --git a/WebCore/platform/network/curl/ResourceError.h b/WebCore/platform/network/ResourceError.cpp index 0a8eb64..fd0674c 100644 --- a/WebCore/platform/network/curl/ResourceError.h +++ b/WebCore/platform/network/ResourceError.cpp @@ -24,26 +24,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ResourceError_h -#define ResourceError_h +#include "config.h" +#include "ResourceError.h" -#include "ResourceErrorBase.h" - -namespace WebCore { - -class ResourceError : public ResourceErrorBase -{ -public: - ResourceError() - { - } - - ResourceError(const String& domain, int errorCode, const String& failingURL, const String& localizedDescription) - : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription) - { - } -}; - -} - -#endif // ResourceError_h_ diff --git a/WebCore/platform/network/ResourceError.h b/WebCore/platform/network/ResourceError.h new file mode 100644 index 0000000..165dccd --- /dev/null +++ b/WebCore/platform/network/ResourceError.h @@ -0,0 +1,168 @@ +// -*- mode: c++; c-basic-offset: 4 -*- +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * + * 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 COMPUTER, INC. ``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. + */ + +#ifndef ResourceError_h +#define ResourceError_h + +#include "PlatformString.h" + +#if PLATFORM(CF) +#include <wtf/RetainPtr.h> +#endif + +#ifdef __OBJC__ +@class NSError; +#else +class NSError; +#endif + +#if USE(CFNETWORK) +#include <CoreFoundation/CFStream.h> +#endif + +namespace WebCore { + + class ResourceError { + public: + ResourceError() + : m_errorCode(0) +#if PLATFORM(CF) + , m_dataIsUpToDate(true) +#endif + , m_isNull(true) + { + } + + ResourceError(const String& domain, int errorCode, const String& failingURL, const String& localizedDescription) + : m_domain(domain) + , m_errorCode(errorCode) + , m_failingURL(failingURL) + , m_localizedDescription(localizedDescription) +#if PLATFORM(CF) + , m_dataIsUpToDate(true) +#endif + , m_isNull(false) + { + } + +#if PLATFORM(CF) +#if PLATFORM(MAC) + ResourceError(NSError* error) +#else + ResourceError(CFStreamError error); + ResourceError(CFErrorRef error) +#endif + : m_dataIsUpToDate(false) + , m_platformError(error) + , m_isNull(!error) + { + } +#endif + +#if 0 + static const String CocoaErrorDomain; + static const String POSIXDomain; + static const String OSStatusDomain; + static const String MachDomain; + static const String WebKitDomain; +#endif + + bool isNull() const { return m_isNull; } + + const String& domain() const { unpackPlatformErrorIfNeeded(); return m_domain; } + int errorCode() const { unpackPlatformErrorIfNeeded(); return m_errorCode; } + const String& failingURL() const { unpackPlatformErrorIfNeeded(); return m_failingURL; } + const String& localizedDescription() const { unpackPlatformErrorIfNeeded(); return m_localizedDescription; } + +#if PLATFORM(CF) +#if PLATFORM(MAC) + operator NSError*() const; +#else + operator CFErrorRef() const; + operator CFStreamError() const; +#endif +#endif + + private: + void unpackPlatformErrorIfNeeded() const + { +#if PLATFORM(CF) + if (!m_dataIsUpToDate) + const_cast<ResourceError*>(this)->unpackPlatformError(); +#endif + } + +#if PLATFORM(CF) + void unpackPlatformError(); +#endif + + String m_domain; + int m_errorCode; + String m_failingURL; + String m_localizedDescription; + +#if PLATFORM(CF) + bool m_dataIsUpToDate; +#endif +#if PLATFORM(MAC) + mutable RetainPtr<NSError> m_platformError; +#elif PLATFORM(CF) + mutable RetainPtr<CFErrorRef> m_platformError; +#endif + bool m_isNull; +}; + +inline bool operator==(const ResourceError& a, const ResourceError& b) +{ + if (a.isNull() && b.isNull()) + return true; + if (a.isNull() || b.isNull()) + return false; + if (a.domain() != b.domain()) + return false; + if (a.errorCode() != b.errorCode()) + return false; + if (a.failingURL() != b.failingURL()) + return false; + if (a.localizedDescription() != b.localizedDescription()) + return false; +#if PLATFORM(CF) +#if PLATFORM(MAC) + if ((NSError *)a != (NSError *)b) + return false; +#else + if ((CFErrorRef)a != (CFErrorRef)b) + return false; +#endif +#endif + return true; +} + +inline bool operator!=(const ResourceError& a, const ResourceError& b) { return !(a == b); } + +} // namespace WebCore + +#endif // ResourceError_h_ diff --git a/WebCore/platform/network/ResourceErrorBase.cpp b/WebCore/platform/network/ResourceErrorBase.cpp deleted file mode 100644 index 5dfc890..0000000 --- a/WebCore/platform/network/ResourceErrorBase.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// -*- mode: c++; c-basic-offset: 4 -*- -/* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. - * - * 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 COMPUTER, INC. ``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 "ResourceError.h" - -namespace WebCore { - -void ResourceErrorBase::lazyInit() const -{ - const_cast<ResourceError*>(static_cast<const ResourceError*>(this))->platformLazyInit(); -} - -bool ResourceErrorBase::compare(const ResourceError& a, const ResourceError& b) -{ - if (a.isNull() && b.isNull()) - return true; - - if (a.isNull() || b.isNull()) - return false; - - if (a.domain() != b.domain()) - return false; - - if (a.errorCode() != b.errorCode()) - return false; - - if (a.failingURL() != b.failingURL()) - return false; - - if (a.localizedDescription() != b.localizedDescription()) - return false; - - return platformCompare(a, b); -} - -} diff --git a/WebCore/platform/network/ResourceErrorBase.h b/WebCore/platform/network/ResourceErrorBase.h deleted file mode 100644 index ccdf36a..0000000 --- a/WebCore/platform/network/ResourceErrorBase.h +++ /dev/null @@ -1,83 +0,0 @@ -// -*- mode: c++; c-basic-offset: 4 -*- -/* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. - * - * 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 COMPUTER, INC. ``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. - */ - -#ifndef ResourceErrorBase_h -#define ResourceErrorBase_h - -#include "PlatformString.h" - -namespace WebCore { - -class ResourceError; - -class ResourceErrorBase { -public: - bool isNull() const { return m_isNull; } - - const String& domain() const { lazyInit(); return m_domain; } - int errorCode() const { lazyInit(); return m_errorCode; } - const String& failingURL() const { lazyInit(); return m_failingURL; } - const String& localizedDescription() const { lazyInit(); return m_localizedDescription; } - - static bool compare(const ResourceError& a, const ResourceError& b); - -protected: - ResourceErrorBase() - : m_errorCode(0) - , m_isNull(true) - { - } - - ResourceErrorBase(const String& domain, int errorCode, const String& failingURL, const String& localizedDescription) - : m_domain(domain) - , m_errorCode(errorCode) - , m_failingURL(failingURL) - , m_localizedDescription(localizedDescription) - , m_isNull(false) - { - } - - void lazyInit() const; - - // The ResourceError subclass may "shadow" this method to lazily initialize platform specific fields - void platformLazyInit() {} - - // The ResourceError subclass may "shadow" this method to compare platform specific fields - static bool platformCompare(const ResourceError& a, const ResourceError& b) { return true; } - - String m_domain; - int m_errorCode; - String m_failingURL; - String m_localizedDescription; - bool m_isNull; -}; - -inline bool operator==(const ResourceError& a, const ResourceError& b) { return ResourceErrorBase::compare(a, b); } -inline bool operator!=(const ResourceError& a, const ResourceError& b) { return !(a == b); } - -} // namespace WebCore - -#endif // ResourceErrorBase_h_ diff --git a/WebCore/platform/network/ResourceHandle.cpp b/WebCore/platform/network/ResourceHandle.cpp index ef07a05..969a9f6 100644 --- a/WebCore/platform/network/ResourceHandle.cpp +++ b/WebCore/platform/network/ResourceHandle.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -43,7 +43,7 @@ ResourceHandle::ResourceHandle(const ResourceRequest& request, ResourceHandleCli PassRefPtr<ResourceHandle> ResourceHandle::create(const ResourceRequest& request, ResourceHandleClient* client, Frame* frame, bool defersLoading, bool shouldContentSniff, bool mightDownloadFromHandle) { - RefPtr<ResourceHandle> newHandle(adoptRef(new ResourceHandle(request, client, defersLoading, shouldContentSniff, mightDownloadFromHandle))); + RefPtr<ResourceHandle> newHandle(new ResourceHandle(request, client, defersLoading, shouldContentSniff, mightDownloadFromHandle)); if (!portAllowed(request)) { newHandle->scheduleBlockedFailure(); @@ -172,11 +172,11 @@ bool ResourceHandle::portAllowed(const ResourceRequest& request) return true; // Allow ports 21 and 22 for FTP URLs, as Mozilla does. - if ((port == 21 || port == 22) && request.url().protocolIs("ftp")) + if ((port == 21 || port == 22) && request.url().deprecatedString().startsWith("ftp:", false)) return true; // Allow any port number in a file URL, since the port number is ignored. - if (request.url().protocolIs("file")) + if (request.url().deprecatedString().startsWith("file:", false)) return true; return false; diff --git a/WebCore/platform/network/ResourceHandle.h b/WebCore/platform/network/ResourceHandle.h index e5a8065..c94a875 100644 --- a/WebCore/platform/network/ResourceHandle.h +++ b/WebCore/platform/network/ResourceHandle.h @@ -134,7 +134,7 @@ public: friend LRESULT __stdcall ResourceHandleWndProc(HWND, unsigned message, WPARAM, LPARAM); #endif -#if PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(WX) +#if PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(WX) || defined(ANDROID) ResourceHandleInternal* getInternal() { return d.get(); } #endif diff --git a/WebCore/platform/network/ResourceHandleInternal.h b/WebCore/platform/network/ResourceHandleInternal.h index 16f960e..c4b8b25 100644 --- a/WebCore/platform/network/ResourceHandleInternal.h +++ b/WebCore/platform/network/ResourceHandleInternal.h @@ -60,6 +60,12 @@ class NSURLConnection; #endif #endif +#ifdef ANDROID_BRIDGE +namespace android { + class WebCoreResourceLoader; +} +#endif + // The allocations and releases in ResourceHandleInternal are // Cocoa-exception-free (either simple Foundation classes or // WebCoreResourceLoaderImp which avoids doing work in dealloc). @@ -111,6 +117,9 @@ namespace WebCore { #elif USE(CFNETWORK) , m_currentCFChallenge(0) #endif +#ifdef ANDROID_BRIDGE + , m_loader(0) +#endif { } @@ -174,6 +183,9 @@ namespace WebCore { #if USE(CFNETWORK) CFURLAuthChallengeRef m_currentCFChallenge; #endif +#ifdef ANDROID_BRIDGE + android::WebCoreResourceLoader* m_loader; +#endif AuthenticationChallenge m_currentWebChallenge; }; diff --git a/WebCore/platform/network/ResourceResponseBase.cpp b/WebCore/platform/network/ResourceResponseBase.cpp index 0c41847..06cc5ce 100644 --- a/WebCore/platform/network/ResourceResponseBase.cpp +++ b/WebCore/platform/network/ResourceResponseBase.cpp @@ -30,9 +30,14 @@ namespace WebCore { +inline const ResourceResponse& ResourceResponseBase::asResourceResponse() const +{ + return *static_cast<const ResourceResponse*>(this); +} + bool ResourceResponseBase::isHTTP() const { - lazyInit(); + updateResourceResponse(); String protocol = m_url.protocol(); @@ -41,14 +46,14 @@ bool ResourceResponseBase::isHTTP() const const KURL& ResourceResponseBase::url() const { - lazyInit(); + updateResourceResponse(); return m_url; } void ResourceResponseBase::setUrl(const KURL& url) { - lazyInit(); + updateResourceResponse(); m_isNull = false; m_url = url; @@ -56,14 +61,14 @@ void ResourceResponseBase::setUrl(const KURL& url) const String& ResourceResponseBase::mimeType() const { - lazyInit(); + updateResourceResponse(); return m_mimeType; } void ResourceResponseBase::setMimeType(const String& mimeType) { - lazyInit(); + updateResourceResponse(); m_isNull = false; m_mimeType = mimeType; @@ -71,14 +76,14 @@ void ResourceResponseBase::setMimeType(const String& mimeType) long long ResourceResponseBase::expectedContentLength() const { - lazyInit(); + updateResourceResponse(); return m_expectedContentLength; } void ResourceResponseBase::setExpectedContentLength(long long expectedContentLength) { - lazyInit(); + updateResourceResponse(); m_isNull = false; m_expectedContentLength = expectedContentLength; @@ -86,14 +91,14 @@ void ResourceResponseBase::setExpectedContentLength(long long expectedContentLen const String& ResourceResponseBase::textEncodingName() const { - lazyInit(); + updateResourceResponse(); return m_textEncodingName; } void ResourceResponseBase::setTextEncodingName(const String& encodingName) { - lazyInit(); + updateResourceResponse(); m_isNull = false; m_textEncodingName = encodingName; @@ -102,14 +107,14 @@ void ResourceResponseBase::setTextEncodingName(const String& encodingName) // FIXME should compute this on the fly const String& ResourceResponseBase::suggestedFilename() const { - lazyInit(); + updateResourceResponse(); return m_suggestedFilename; } void ResourceResponseBase::setSuggestedFilename(const String& suggestedName) { - lazyInit(); + updateResourceResponse(); m_isNull = false; m_suggestedFilename = suggestedName; @@ -117,56 +122,56 @@ void ResourceResponseBase::setSuggestedFilename(const String& suggestedName) int ResourceResponseBase::httpStatusCode() const { - lazyInit(); + updateResourceResponse(); return m_httpStatusCode; } void ResourceResponseBase::setHTTPStatusCode(int statusCode) { - lazyInit(); + updateResourceResponse(); m_httpStatusCode = statusCode; } const String& ResourceResponseBase::httpStatusText() const { - lazyInit(); + updateResourceResponse(); return m_httpStatusText; } void ResourceResponseBase::setHTTPStatusText(const String& statusText) { - lazyInit(); + updateResourceResponse(); m_httpStatusText = statusText; } String ResourceResponseBase::httpHeaderField(const String& name) const { - lazyInit(); + updateResourceResponse(); return m_httpHeaderFields.get(name); } void ResourceResponseBase::setHTTPHeaderField(const String& name, const String& value) { - lazyInit(); + updateResourceResponse(); m_httpHeaderFields.set(name, value); } const HTTPHeaderMap& ResourceResponseBase::httpHeaderFields() const { - lazyInit(); + updateResourceResponse(); return m_httpHeaderFields; } bool ResourceResponseBase::isAttachment() const { - lazyInit(); + updateResourceResponse(); String value = m_httpHeaderFields.get("Content-Disposition"); int loc = value.find(';'); @@ -178,38 +183,43 @@ bool ResourceResponseBase::isAttachment() const void ResourceResponseBase::setExpirationDate(time_t expirationDate) { - lazyInit(); + updateResourceResponse(); m_expirationDate = expirationDate; } time_t ResourceResponseBase::expirationDate() const { - lazyInit(); + updateResourceResponse(); return m_expirationDate; } void ResourceResponseBase::setLastModifiedDate(time_t lastModifiedDate) { - lazyInit(); + updateResourceResponse(); m_lastModifiedDate = lastModifiedDate; } time_t ResourceResponseBase::lastModifiedDate() const { - lazyInit(); + updateResourceResponse(); return m_lastModifiedDate; } -void ResourceResponseBase::lazyInit() const +void ResourceResponseBase::updateResourceResponse() const { - const_cast<ResourceResponse*>(static_cast<const ResourceResponse*>(this))->platformLazyInit(); + if (m_isUpToDate) + return; + + const_cast<ResourceResponse&>(asResourceResponse()).doUpdateResourceResponse(); + + m_isUpToDate = true; } -bool ResourceResponseBase::compare(const ResourceResponse& a, const ResourceResponse& b) +bool operator==(const ResourceResponse& a, const ResourceResponse& b) { if (a.isNull() != b.isNull()) return false; @@ -231,7 +241,11 @@ bool ResourceResponseBase::compare(const ResourceResponse& a, const ResourceResp return false; if (a.expirationDate() != b.expirationDate()) return false; - return ResourceResponse::platformCompare(a, b); -} +#if PLATFORM(MAC) + if (a.nsURLResponse() != b.nsURLResponse()) + return false; +#endif + return true; + } } diff --git a/WebCore/platform/network/ResourceResponseBase.h b/WebCore/platform/network/ResourceResponseBase.h index 503156a..50b6c43 100644 --- a/WebCore/platform/network/ResourceResponseBase.h +++ b/WebCore/platform/network/ResourceResponseBase.h @@ -77,16 +77,21 @@ class ResourceResponseBase { void setLastModifiedDate(time_t); time_t lastModifiedDate() const; - static bool compare(const ResourceResponse& a, const ResourceResponse& b); - - const ResourceResponse& asResourceResponse() const; + inline const ResourceResponse& asResourceResponse() const; protected: + // Used when response is initialized from a platform representation + ResourceResponseBase(bool isNull) + : m_isUpToDate(false) + , m_isNull(isNull) + { + } + ResourceResponseBase() : m_expectedContentLength(0) , m_httpStatusCode(0) , m_expirationDate(0) - , m_lastModifiedDate(0) + , m_isUpToDate(true) , m_isNull(true) { } @@ -99,34 +104,29 @@ class ResourceResponseBase { , m_suggestedFilename(filename) , m_httpStatusCode(0) , m_expirationDate(0) - , m_lastModifiedDate(0) + , m_isUpToDate(true) , m_isNull(false) { } - void lazyInit() const; - - // The ResourceResponse subclass may "shadow" this method to lazily initialize platform specific fields - void platformLazyInit() {} - - // The ResourceResponse subclass may "shadow" this method to compare platform specific fields - static bool platformCompare(const ResourceResponse& a, const ResourceResponse& b) { return true; } + void updateResourceResponse() const; KURL m_url; String m_mimeType; long long m_expectedContentLength; String m_textEncodingName; String m_suggestedFilename; - int m_httpStatusCode; + mutable int m_httpStatusCode; String m_httpStatusText; HTTPHeaderMap m_httpHeaderFields; time_t m_expirationDate; time_t m_lastModifiedDate; + mutable bool m_isUpToDate; bool m_isNull; }; -inline bool operator==(const ResourceResponse& a, const ResourceResponse& b) { return ResourceResponseBase::compare(a, b); } +bool operator==(const ResourceResponse& a, const ResourceResponse& b); inline bool operator!=(const ResourceResponse& a, const ResourceResponse& b) { return !(a == b); } } // namespace WebCore diff --git a/WebCore/platform/network/android/ResourceHandleAndroid.cpp b/WebCore/platform/network/android/ResourceHandleAndroid.cpp new file mode 100644 index 0000000..35b3c5b --- /dev/null +++ b/WebCore/platform/network/android/ResourceHandleAndroid.cpp @@ -0,0 +1,144 @@ +/* +** +** Copyright 2007, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +#include "config.h" +#include "ResourceHandle.h" + +#include "DocLoader.h" +#include "FrameAndroid.h" +#include "ResourceHandleClient.h" +#include "ResourceHandleInternal.h" +#include "WebCoreFrameBridge.h" +#include "WebCoreResourceLoader.h" + +// #define notImplemented() do { fprintf(stderr, "FIXME: UNIMPLEMENTED %s %s:%d\n", __PRETTY_FUNCTION__, __FILE__, __LINE__); } while(0) + +namespace WebCore { + +ResourceHandleInternal::~ResourceHandleInternal() +{ + Release(m_loader); +} + +ResourceHandle::~ResourceHandle() +{ +} + +bool ResourceHandle::start(Frame* frame) +{ + FrameAndroid* f = Android(frame); + android::WebCoreResourceLoader* loader; + bool highPriority = true; + CachedResource* r = d->m_request.getCachedResource(); + if (r) { + CachedResource::Type t = r->type(); + highPriority = !(t == CachedResource::ImageResource || + t == CachedResource::FontResource); + } + loader = f->bridge()->startLoadingResource(this, d->m_request, highPriority, false); + + if (loader) { + Release(d->m_loader); + d->m_loader = loader; + } + + return loader != NULL; +} + +void ResourceHandle::cancel() +{ + if (d->m_loader) + d->m_loader->cancel(); +} + +PassRefPtr<SharedBuffer> ResourceHandle::bufferedData() +{ + return 0; +} + +bool ResourceHandle::supportsBufferedData() +{ + // We don't support buffering data on the native side. + return false; +} + +void ResourceHandle::setDefersLoading(bool defers) +{ + notImplemented(); +} + +/* +* This static method is called to check to see if a POST response is in +* the cache. The JNI call through to the HTTP cache stored on the Java +* side may be slow, but is only used during a navigation to +* a POST response. +*/ +bool ResourceHandle::willLoadFromCache(ResourceRequest& request) +{ + // set the cache policy correctly, copied from + // network/mac/ResourceHandleMac.mm + request.setCachePolicy(ReturnCacheDataDontLoad); + return android::WebCoreResourceLoader::willLoadFromCache(request.url()); +} + +bool ResourceHandle::loadsBlocked() +{ + // FIXME, need to check whether connection pipe is blocked. + // return false for now + return false; +} + +// Class to handle synchronized loading of resources. +class SyncLoader : public ResourceHandleClient { +public: + SyncLoader(ResourceError& error, ResourceResponse& response, Vector<char>& data) { + m_error = &error; + m_response = &response; + m_data = &data; + } + ~SyncLoader() {} + + virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse& response) { + *m_response = response; + } + + virtual void didReceiveData(ResourceHandle*, const char* data, int len, int lengthReceived) { + m_data->append(data, len); + } + + virtual void didFail(ResourceHandle*, const ResourceError& error) { + *m_error = error; + } + +private: + ResourceError* m_error; + ResourceResponse* m_response; + Vector<char>* m_data; +}; + +void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, + ResourceError& error, ResourceResponse& response, Vector<char>& data, + Frame* frame) +{ + FrameAndroid* f = Android(frame); + SyncLoader s(error, response, data); + ResourceHandle h(request, &s, false, false, false); + // This blocks until the load is finished. + f->bridge()->startLoadingResource(&h, request, true, true); +} + +} // namespace WebCore diff --git a/WebCore/platform/network/android/ResourceRequest.h b/WebCore/platform/network/android/ResourceRequest.h new file mode 100644 index 0000000..33676ae --- /dev/null +++ b/WebCore/platform/network/android/ResourceRequest.h @@ -0,0 +1,93 @@ +// -*- mode: c++; c-basic-offset: 4 -*- +/* + * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * 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 COMPUTER, INC. ``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. + */ + +#ifndef ResourceRequest_h +#define ResourceRequest_h + +#include "CachedResource.h" +#include "ResourceRequestBase.h" + +namespace WebCore { + + struct ResourceRequest : ResourceRequestBase { + + ResourceRequest(const String& url) + : ResourceRequestBase(KURL(url.deprecatedString()), UseProtocolCachePolicy) + , m_cachedResource(0) +#ifdef ANDROID_USER_GESTURE + , m_wasUserGesture(false) +#endif + { + } + + ResourceRequest(const KURL& url) + : ResourceRequestBase(url, UseProtocolCachePolicy) + , m_cachedResource(0) +#ifdef ANDROID_USER_GESTURE + , m_wasUserGesture(false) +#endif + { + } + + ResourceRequest(const KURL& url, const String& referrer, ResourceRequestCachePolicy policy = UseProtocolCachePolicy) + : ResourceRequestBase(url, policy) + , m_cachedResource(0) +#ifdef ANDROID_USER_GESTURE + , m_wasUserGesture(false) +#endif + { + setHTTPReferrer(referrer); + } + + ResourceRequest() + : ResourceRequestBase(KURL(), UseProtocolCachePolicy) + , m_cachedResource(0) +#ifdef ANDROID_USER_GESTURE + , m_wasUserGesture(false) +#endif + { + } + + void doUpdatePlatformRequest() {} + void doUpdateResourceRequest() {} + void setCachedResource(CachedResource* r) { m_cachedResource = r; } + CachedResource* getCachedResource() const { return m_cachedResource; } +#ifdef ANDROID_USER_GESTURE + void setUserGesture(bool userGesture) { m_wasUserGesture = userGesture; } + bool userGesture() const { return m_wasUserGesture; } +#endif + private: + friend class ResourceRequestBase; + CachedResource* m_cachedResource; +#ifdef ANDROID_USER_GESTURE + bool m_wasUserGesture; +#endif + }; + +} // namespace WebCore + +#endif // ResourceRequest_h diff --git a/WebCore/platform/network/qt/ResourceError.h b/WebCore/platform/network/android/ResourceResponse.h index 0a8eb64..94c93f5 100644 --- a/WebCore/platform/network/qt/ResourceError.h +++ b/WebCore/platform/network/android/ResourceResponse.h @@ -24,26 +24,37 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ResourceError_h -#define ResourceError_h +#ifndef ResourceResponse_h +#define ResourceResponse_h -#include "ResourceErrorBase.h" +#include "ResourceResponseBase.h" + +#include "NotImplemented.h" namespace WebCore { -class ResourceError : public ResourceErrorBase -{ +class ResourceResponse : public ResourceResponseBase { public: - ResourceError() + ResourceResponse() + : ResourceResponseBase() + { + } + + ResourceResponse(const KURL& url, const String& mimeType, long long expectedLength, const String& textEncodingName, const String& filename) + : ResourceResponseBase(url, mimeType, expectedLength, textEncodingName, filename) { } - ResourceError(const String& domain, int errorCode, const String& failingURL, const String& localizedDescription) - : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription) +private: + friend class ResourceResponseBase; + + void doUpdateResourceResponse() { + notImplemented(); } + }; -} +} // namespace WebCore -#endif // ResourceError_h_ +#endif // ResourceResponse_h diff --git a/WebCore/platform/network/cf/AuthenticationCF.cpp b/WebCore/platform/network/cf/AuthenticationCF.cpp index bb05a39..72a6c9a 100644 --- a/WebCore/platform/network/cf/AuthenticationCF.cpp +++ b/WebCore/platform/network/cf/AuthenticationCF.cpp @@ -37,42 +37,18 @@ namespace WebCore { -AuthenticationChallenge::AuthenticationChallenge(const ProtectionSpace& protectionSpace, - const Credential& proposedCredential, - unsigned previousFailureCount, - const ResourceResponse& response, - const ResourceError& error) - : AuthenticationChallengeBase(protectionSpace, - proposedCredential, - previousFailureCount, - response, - error) -{ -} - -AuthenticationChallenge::AuthenticationChallenge(CFURLAuthChallengeRef cfChallenge, - ResourceHandle* sourceHandle) - : AuthenticationChallengeBase(core(CFURLAuthChallengeGetProtectionSpace(cfChallenge)), - core(CFURLAuthChallengeGetProposedCredential(cfChallenge)), - CFURLAuthChallengeGetPreviousFailureCount(cfChallenge), - (CFURLResponseRef)CFURLAuthChallengeGetFailureResponse(cfChallenge), - CFURLAuthChallengeGetError(cfChallenge)) +AuthenticationChallenge::AuthenticationChallenge(CFURLAuthChallengeRef cfChallenge, ResourceHandle* sourceHandle) + : m_isNull(false) + , m_protectionSpace(core(CFURLAuthChallengeGetProtectionSpace(cfChallenge))) + , m_proposedCredential(core(CFURLAuthChallengeGetProposedCredential(cfChallenge))) + , m_previousFailureCount(CFURLAuthChallengeGetPreviousFailureCount(cfChallenge)) + , m_failureResponse((CFURLResponseRef)CFURLAuthChallengeGetFailureResponse(cfChallenge)) + , m_error(CFURLAuthChallengeGetError(cfChallenge)) , m_sourceHandle(sourceHandle) , m_cfChallenge(cfChallenge) { } -bool AuthenticationChallenge::platformCompare(const AuthenticationChallenge& a, const AuthenticationChallenge& b) -{ - if (a.sourceHandle() != b.sourceHandle()) - return false; - - if (a.cfURLAuthChallengeRef() != b.cfURLAuthChallengeRef()) - return false; - - return true; -} - CFURLAuthChallengeRef createCF(const AuthenticationChallenge& coreChallenge) { CFURLProtectionSpaceRef protectionSpace = createCF(coreChallenge.protectionSpace()); diff --git a/WebCore/platform/network/cf/AuthenticationChallenge.h b/WebCore/platform/network/cf/AuthenticationChallenge.h deleted file mode 100644 index 9697d7e..0000000 --- a/WebCore/platform/network/cf/AuthenticationChallenge.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * 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 COMPUTER, INC. ``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. - */ -#ifndef AuthenticationChallenge_h -#define AuthenticationChallenge_h - -#include "AuthenticationChallengeBase.h" -#include "ResourceHandle.h" -#include <wtf/RefPtr.h> - -typedef struct _CFURLAuthChallenge* CFURLAuthChallengeRef; - -namespace WebCore { - -class ResourceHandle; - -class AuthenticationChallenge : public AuthenticationChallengeBase { -public: - AuthenticationChallenge() {} - AuthenticationChallenge(const ProtectionSpace& protectionSpace, const Credential& proposedCredential, unsigned previousFailureCount, const ResourceResponse& response, const ResourceError& error); - AuthenticationChallenge(CFURLAuthChallengeRef, ResourceHandle* sourceHandle); - - ResourceHandle* sourceHandle() const { return m_sourceHandle.get(); } - CFURLAuthChallengeRef cfURLAuthChallengeRef() const { return m_cfChallenge.get(); } - -private: - friend class AuthenticationChallengeBase; - static bool platformCompare(const AuthenticationChallenge& a, const AuthenticationChallenge& b); - - RefPtr<ResourceHandle> m_sourceHandle; - RetainPtr<CFURLAuthChallengeRef> m_cfChallenge; -}; - -} - -#endif diff --git a/WebCore/platform/network/cf/FormDataStreamCFNet.cpp b/WebCore/platform/network/cf/FormDataStreamCFNet.cpp index 71fbfe7..c2416a1 100644 --- a/WebCore/platform/network/cf/FormDataStreamCFNet.cpp +++ b/WebCore/platform/network/cf/FormDataStreamCFNet.cpp @@ -389,11 +389,11 @@ void setHTTPBody(CFMutableURLRequestRef request, PassRefPtr<FormData> formData) PassRefPtr<FormData> httpBodyFromRequest(CFURLRequestRef request) { if (RetainPtr<CFDataRef> bodyData = CFURLRequestCopyHTTPRequestBody(request)) - return FormData::create(CFDataGetBytePtr(bodyData.get()), CFDataGetLength(bodyData.get())); + return new FormData(CFDataGetBytePtr(bodyData.get()), CFDataGetLength(bodyData.get())); if (wkCanAccessCFURLRequestHTTPBodyParts()) { if (RetainPtr<CFArrayRef> bodyParts = wkCFURLRequestCopyHTTPRequestBodyParts(request)) { - RefPtr<FormData> formData = FormData::create(); + RefPtr<FormData> formData = new FormData(); CFIndex count = CFArrayGetCount(bodyParts.get()); for (CFIndex i = 0; i < count; i++) { @@ -405,8 +405,9 @@ PassRefPtr<FormData> httpBodyFromRequest(CFURLRequestRef request) } else if (typeID == CFDataGetTypeID()) { CFDataRef data = (CFDataRef)bodyPart; formData->appendData(CFDataGetBytePtr(data), CFDataGetLength(data)); - } else + } else { ASSERT_NOT_REACHED(); + } } return formData.release(); } diff --git a/WebCore/platform/network/cf/ResourceError.h b/WebCore/platform/network/cf/ResourceError.h deleted file mode 100644 index 1cde47e..0000000 --- a/WebCore/platform/network/cf/ResourceError.h +++ /dev/null @@ -1,74 +0,0 @@ -// -*- mode: c++; c-basic-offset: 4 -*- -/* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. - * - * 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 COMPUTER, INC. ``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. - */ - -#ifndef ResourceError_h -#define ResourceError_h - -#include "ResourceErrorBase.h" - -#include <wtf/RetainPtr.h> -#include <CoreFoundation/CFStream.h> - -namespace WebCore { - -class ResourceError : public ResourceErrorBase { -public: - ResourceError() - : m_dataIsUpToDate(true) - { - } - - ResourceError(const String& domain, int errorCode, const String& failingURL, const String& localizedDescription) - : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription) - , m_dataIsUpToDate(true) - { - } - - ResourceError(CFStreamError error); - - ResourceError(CFErrorRef error) - : m_dataIsUpToDate(false) - , m_platformError(error) - { - m_isNull = !error; - } - - operator CFErrorRef() const; - operator CFStreamError() const; - -private: - friend class ResourceErrorBase; - - void platformLazyInit(); - static bool platformCompare(const ResourceError& a, const ResourceError& b); - - bool m_dataIsUpToDate; - mutable RetainPtr<CFErrorRef> m_platformError; -}; - -} // namespace WebCore - -#endif // ResourceError_h_ diff --git a/WebCore/platform/network/cf/ResourceErrorCF.cpp b/WebCore/platform/network/cf/ResourceErrorCF.cpp index 8e82cd5..f9ad76d 100644 --- a/WebCore/platform/network/cf/ResourceErrorCF.cpp +++ b/WebCore/platform/network/cf/ResourceErrorCF.cpp @@ -45,11 +45,10 @@ const CFStringRef failingURLKey = CFSTR("NSErrorFailingURLKey"); // FIXME: Once <rdar://problem/5050841> is fixed we can remove this constructor. ResourceError::ResourceError(CFStreamError error) - : m_dataIsUpToDate(true) + : m_errorCode(error.error) + , m_isNull(false) + , m_dataIsUpToDate(true) { - m_isNull = false; - m_errorCode = error.error; - switch(error.domain) { case kCFStreamErrorDomainCustom: m_domain ="NSCustomErrorDomain"; @@ -63,11 +62,8 @@ ResourceError::ResourceError(CFStreamError error) } } -void ResourceError::platformLazyInit() +void ResourceError::unpackPlatformError() { - if (m_dataIsUpToDate) - return; - if (!m_platformError) return; @@ -106,11 +102,6 @@ void ResourceError::platformLazyInit() m_dataIsUpToDate = true; } -bool ResourceError::platformCompare(const ResourceError& a, const ResourceError& b) -{ - return (CFErrorRef)a == (CFErrorRef)b; -} - ResourceError::operator CFErrorRef() const { if (m_isNull) { @@ -129,7 +120,7 @@ ResourceError::operator CFErrorRef() const if (!m_failingURL.isEmpty()) { RetainPtr<CFStringRef> failingURLString(AdoptCF, m_failingURL.createCFString()); CFDictionarySetValue(userInfo.get(), failingURLStringKey, failingURLString.get()); - RetainPtr<CFURLRef> url(AdoptCF, KURL(m_failingURL).createCFURL()); + RetainPtr<CFURLRef> url(AdoptCF, KURL(m_failingURL.deprecatedString()).createCFURL()); CFDictionarySetValue(userInfo.get(), failingURLKey, url.get()); } @@ -142,7 +133,7 @@ ResourceError::operator CFErrorRef() const ResourceError::operator CFStreamError() const { - lazyInit(); + unpackPlatformErrorIfNeeded(); CFStreamError result; result.error = m_errorCode; diff --git a/WebCore/platform/network/cf/ResourceRequest.h b/WebCore/platform/network/cf/ResourceRequest.h index 5c49b06..5070380 100644 --- a/WebCore/platform/network/cf/ResourceRequest.h +++ b/WebCore/platform/network/cf/ResourceRequest.h @@ -38,7 +38,7 @@ namespace WebCore { struct ResourceRequest : ResourceRequestBase { ResourceRequest(const String& url) - : ResourceRequestBase(KURL(url), UseProtocolCachePolicy) + : ResourceRequestBase(KURL(url.deprecatedString()), UseProtocolCachePolicy) { } diff --git a/WebCore/platform/network/cf/ResourceResponse.h b/WebCore/platform/network/cf/ResourceResponse.h index 7e7c0fa..c930dfc 100644 --- a/WebCore/platform/network/cf/ResourceResponse.h +++ b/WebCore/platform/network/cf/ResourceResponse.h @@ -36,20 +36,16 @@ namespace WebCore { class ResourceResponse : public ResourceResponseBase { public: ResourceResponse() - : m_isUpToDate(true) + : ResourceResponseBase() { } ResourceResponse(CFURLResponseRef cfResponse) - : m_cfResponse(cfResponse) - , m_isUpToDate(false) - { - m_isNull = !cfResponse; - } + : ResourceResponseBase(!cfResponse) + , m_cfResponse(cfResponse) { } ResourceResponse(const KURL& url, const String& mimeType, long long expectedLength, const String& textEncodingName, const String& filename) : ResourceResponseBase(url, mimeType, expectedLength, textEncodingName, filename) - , m_isUpToDate(true) { } @@ -58,11 +54,10 @@ public: private: friend class ResourceResponseBase; - void platformLazyInit(); - static bool platformCompare(const ResourceResponse& a, const ResourceResponse& b); + void doUpdateResourceResponse(); RetainPtr<CFURLResponseRef> m_cfResponse; - bool m_isUpToDate; + }; } // namespace WebCore diff --git a/WebCore/platform/network/cf/ResourceResponseCFNet.cpp b/WebCore/platform/network/cf/ResourceResponseCFNet.cpp index 79efe89..d643f8e 100644 --- a/WebCore/platform/network/cf/ResourceResponseCFNet.cpp +++ b/WebCore/platform/network/cf/ResourceResponseCFNet.cpp @@ -62,16 +62,10 @@ static time_t toTimeT(CFAbsoluteTime time) return min(max(minTimeAsDouble, time + kCFAbsoluteTimeIntervalSince1970), maxTimeAsDouble); } -void ResourceResponse::platformLazyInit() +void ResourceResponse::doUpdateResourceResponse() { - if (m_isUpToDate) + if (!m_cfResponse.get()) return; - m_isUpToDate = true; - - if (m_isNull) { - ASSERT(!m_cfResponse.get()); - return; - } // FIXME: We may need to do MIME type sniffing here (unless that is done in CFURLResponseGetMIMEType). @@ -108,10 +102,4 @@ void ResourceResponse::platformLazyInit() m_httpStatusCode = 0; } -bool ResourceResponse::platformCompare(const ResourceResponse& a, const ResourceResponse& b) -{ - return CFEqual(a.cfURLResponse(), b.cfURLResponse()); -} - - } diff --git a/WebCore/platform/network/curl/AuthenticationChallenge.h b/WebCore/platform/network/curl/AuthenticationChallenge.h deleted file mode 100644 index 753ac6f..0000000 --- a/WebCore/platform/network/curl/AuthenticationChallenge.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * 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 COMPUTER, INC. ``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. - */ -#ifndef AuthenticationChallenge_h -#define AuthenticationChallenge_h - -#include "AuthenticationChallengeBase.h" - -namespace WebCore { - -class AuthenticationChallenge : public AuthenticationChallengeBase { -public: - AuthenticationChallenge() - { - } - - AuthenticationChallenge(const ProtectionSpace& protectionSpace, const Credential& proposedCredential, unsigned previousFailureCount, const ResourceResponse& response, const ResourceError& error) - : AuthenticationChallengeBase(protectionSpace, proposedCredential, previousFailureCount, response, error) - { - } -}; - -} - -#endif diff --git a/WebCore/platform/network/curl/ResourceHandleManager.cpp b/WebCore/platform/network/curl/ResourceHandleManager.cpp index b8fa696..249aa4e 100644 --- a/WebCore/platform/network/curl/ResourceHandleManager.cpp +++ b/WebCore/platform/network/curl/ResourceHandleManager.cpp @@ -42,20 +42,12 @@ #include <errno.h> #include <wtf/Vector.h> -#if PLATFORM(GTK) - #if GLIB_CHECK_VERSION(2,12,0) - #define USE_GLIB_BASE64 - #endif -#endif - namespace WebCore { const int selectTimeoutMS = 5; const double pollTimeSeconds = 0.05; const int maxRunningJobs = 5; -static const bool ignoreSSLErrors = getenv("WEBKIT_IGNORE_SSL_ERRORS"); - ResourceHandleManager::ResourceHandleManager() : m_downloadTimer(this, &ResourceHandleManager::downloadTimerCallback) , m_cookieJarFileName(0) @@ -174,7 +166,7 @@ static size_t headerCallback(char* ptr, size_t size, size_t nmemb, void* data) if (httpCode >= 300 && httpCode < 400) { String location = d->m_response.httpHeaderField("location"); if (!location.isEmpty()) { - KURL newURL = KURL(job->request().url(), location); + KURL newURL = KURL(job->request().url(), location.deprecatedString()); ResourceRequest redirectedRequest = job->request(); redirectedRequest.setURL(newURL); @@ -279,17 +271,13 @@ void ResourceHandleManager::downloadTimerCallback(Timer<ResourceHandleManager>* // Temporarily disable timers since signals may interrupt select(), raising EINTR errors on some platforms setDeferringTimers(true); - int rc = 0; + int rc; do { FD_ZERO(&fdread); FD_ZERO(&fdwrite); FD_ZERO(&fdexcep); curl_multi_fdset(m_curlMultiHandle, &fdread, &fdwrite, &fdexcep, &maxfd); - // When the 3 file descriptors are empty, winsock will return -1 - // and bail out, stopping the file download. So make sure we - // have valid file descriptors before calling select. - if (maxfd >= 0) - rc = ::select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout); + rc = ::select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout); } while (rc == -1 && errno == EINTR); setDeferringTimers(false); @@ -463,44 +451,35 @@ bool ResourceHandleManager::startScheduledJobs() return started; } -// FIXME: This function does not deal properly with text encodings. static void parseDataUrl(ResourceHandle* handle) { - String data = handle->request().url().string(); + DeprecatedString data = handle->request().url().deprecatedString(); ASSERT(data.startsWith("data:", false)); - String header; + DeprecatedString header; bool base64 = false; int index = data.find(','); if (index != -1) { - header = data.substring(5, index - 5).lower(); - data = data.substring(index + 1); + header = data.mid(5, index - 5).lower(); + data = data.mid(index + 1); if (header.endsWith(";base64")) { base64 = true; header = header.left(header.length() - 7); } } else - data = String(); - - data = decodeURLEscapeSequences(data); - - size_t outLength = 0; - char* outData = 0; - if (base64 && !data.isEmpty()) { - // Use the GLib Base64 if available, since WebCore's decoder isn't - // general-purpose and fails on Acid3 test 97 (whitespace). -#ifdef USE_GLIB_BASE64 - outData = reinterpret_cast<char*>(g_base64_decode(data.utf8().data(), &outLength)); -#else + data = DeprecatedString(); + + data = KURL::decode_string(data); + + if (base64) { Vector<char> out; - if (base64Decode(data.latin1().data(), data.length(), out)) - data = String(out.data(), out.size()); + if (base64Decode(data.ascii(), data.length(), out)) + data = DeprecatedString(out.data(), out.size()); else - data = String(); -#endif + data = DeprecatedString(); } if (header.isEmpty()) @@ -512,22 +491,13 @@ static void parseDataUrl(ResourceHandle* handle) response.setMimeType(extractMIMETypeFromMediaType(header)); response.setTextEncodingName(extractCharsetFromMediaType(header)); - if (outData) - response.setExpectedContentLength(outLength); - else - response.setExpectedContentLength(data.length()); + response.setExpectedContentLength(data.length()); response.setHTTPStatusCode(200); client->didReceiveResponse(handle, response); - if (outData) - client->didReceiveData(handle, outData, outLength, 0); - else - client->didReceiveData(handle, data.latin1().data(), data.length(), 0); - -#ifdef USE_GLIB_BASE64 - g_free(outData); -#endif + if (!data.isEmpty()) + client->didReceiveData(handle, data.ascii(), data.length(), 0); client->didFinishLoading(handle); } @@ -535,8 +505,9 @@ static void parseDataUrl(ResourceHandle* handle) void ResourceHandleManager::startJob(ResourceHandle* job) { KURL kurl = job->request().url(); + String protocol = kurl.protocol(); - if (kurl.protocolIs("data")) { + if (equalIgnoringCase(protocol, "data")) { parseDataUrl(job); return; } @@ -545,15 +516,15 @@ void ResourceHandleManager::startJob(ResourceHandle* job) kurl.setRef(""); ResourceHandleInternal* d = job->getInternal(); - String url = kurl.string(); + DeprecatedString url = kurl.deprecatedString(); if (kurl.isLocalFile()) { - String query = kurl.query(); + DeprecatedString query = kurl.query(); // Remove any query part sent to a local file. if (!query.isEmpty()) url = url.left(url.find(query)); // Determine the MIME type based on the path. - d->m_response.setMimeType(MIMETypeRegistry::getMIMETypeForPath(url)); + d->m_response.setMimeType(MIMETypeRegistry::getMIMETypeForPath(String(url))); } d->m_handle = curl_easy_init(); @@ -573,16 +544,12 @@ void ResourceHandleManager::startJob(ResourceHandle* job) curl_easy_setopt(d->m_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_easy_setopt(d->m_handle, CURLOPT_SHARE, m_curlShareHandle); curl_easy_setopt(d->m_handle, CURLOPT_DNS_CACHE_TIMEOUT, 60 * 5); // 5 minutes - // FIXME: Enable SSL verification when we have a way of shipping certs - // and/or reporting SSL errors to the user. - if (ignoreSSLErrors) - curl_easy_setopt(d->m_handle, CURLOPT_SSL_VERIFYPEER, false); // enable gzip and deflate through Accept-Encoding: curl_easy_setopt(d->m_handle, CURLOPT_ENCODING, ""); // url must remain valid through the request ASSERT(!d->m_url); - d->m_url = strdup(url.latin1().data()); + d->m_url = strdup(url.ascii()); curl_easy_setopt(d->m_handle, CURLOPT_URL, d->m_url); if (m_cookieJarFileName) { @@ -625,7 +592,7 @@ void ResourceHandleManager::startJob(ResourceHandle* job) // timeout will occur and do curl_multi_perform if (ret && ret != CURLM_CALL_MULTI_PERFORM) { #ifndef NDEBUG - printf("Error %d starting job %s\n", ret, job->request().url().string().latin1().data()); + printf("Error %d starting job %s\n", ret, job->request().url().deprecatedString().ascii()); #endif job->cancel(); return; diff --git a/WebCore/platform/network/curl/ResourceRequest.h b/WebCore/platform/network/curl/ResourceRequest.h index c7edb91..fbe2cbc 100644 --- a/WebCore/platform/network/curl/ResourceRequest.h +++ b/WebCore/platform/network/curl/ResourceRequest.h @@ -35,7 +35,7 @@ namespace WebCore { struct ResourceRequest : ResourceRequestBase { ResourceRequest(const String& url) - : ResourceRequestBase(KURL(url), UseProtocolCachePolicy) + : ResourceRequestBase(KURL(url.deprecatedString()), UseProtocolCachePolicy) { } diff --git a/WebCore/platform/network/curl/ResourceResponse.h b/WebCore/platform/network/curl/ResourceResponse.h index 086eae8..ca364b6 100644 --- a/WebCore/platform/network/curl/ResourceResponse.h +++ b/WebCore/platform/network/curl/ResourceResponse.h @@ -34,7 +34,8 @@ namespace WebCore { class ResourceResponse : public ResourceResponseBase { public: ResourceResponse() - : m_responseFired(false) + : ResourceResponseBase(false), + m_responseFired(false) { } @@ -48,7 +49,14 @@ public: bool responseFired() { return m_responseFired; } private: + friend class ResourceResponseBase; + + void doUpdateResourceResponse() + { + } + bool m_responseFired; + }; } // namespace WebCore diff --git a/WebCore/platform/network/mac/AuthenticationMac.mm b/WebCore/platform/network/mac/AuthenticationMac.mm index 54e7681..1555cac 100644 --- a/WebCore/platform/network/mac/AuthenticationMac.mm +++ b/WebCore/platform/network/mac/AuthenticationMac.mm @@ -37,40 +37,18 @@ namespace WebCore { -AuthenticationChallenge::AuthenticationChallenge(const ProtectionSpace& protectionSpace, - const Credential& proposedCredential, - unsigned previousFailureCount, - const ResourceResponse& response, - const ResourceError& error) - : AuthenticationChallengeBase(protectionSpace, - proposedCredential, - previousFailureCount, - response, - error) -{ -} - AuthenticationChallenge::AuthenticationChallenge(NSURLAuthenticationChallenge *macChallenge) - : AuthenticationChallengeBase(core([macChallenge protectionSpace]), - core([macChallenge proposedCredential]), - [macChallenge previousFailureCount], - [macChallenge failureResponse], - [macChallenge error]) + : m_isNull(false) + , m_protectionSpace(core([macChallenge protectionSpace])) + , m_proposedCredential(core([macChallenge proposedCredential])) + , m_previousFailureCount([macChallenge previousFailureCount]) + , m_failureResponse([macChallenge failureResponse]) + , m_error([macChallenge error]) , m_sender([macChallenge sender]) , m_macChallenge(macChallenge) { } -bool AuthenticationChallenge::platformCompare(const AuthenticationChallenge& a, const AuthenticationChallenge& b) -{ - if (a.sender() != b.sender()) - return false; - - if (a.nsURLAuthenticationChallenge() != b.nsURLAuthenticationChallenge()) - return false; - - return true; -} NSURLAuthenticationChallenge *mac(const AuthenticationChallenge& coreChallenge) { diff --git a/WebCore/platform/network/mac/ResourceError.h b/WebCore/platform/network/mac/ResourceError.h deleted file mode 100644 index 5e4a553..0000000 --- a/WebCore/platform/network/mac/ResourceError.h +++ /dev/null @@ -1,75 +0,0 @@ -// -*- mode: c++; c-basic-offset: 4 -*- -/* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. - * - * 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 COMPUTER, INC. ``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. - */ - -#ifndef ResourceError_h -#define ResourceError_h - -#include "ResourceErrorBase.h" -#include <wtf/RetainPtr.h> - -#ifdef __OBJC__ -@class NSError; -#else -class NSError; -#endif - -namespace WebCore { - - class ResourceError : public ResourceErrorBase { - public: - ResourceError() - : m_dataIsUpToDate(true) - { - } - - ResourceError(const String& domain, int errorCode, const String& failingURL, const String& localizedDescription) - : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription) - , m_dataIsUpToDate(true) - { - } - - ResourceError(NSError* error) - : m_dataIsUpToDate(false) - , m_platformError(error) - { - m_isNull = !error; - } - - operator NSError*() const; - - private: - friend class ResourceErrorBase; - - void platformLazyInit(); - static bool platformCompare(const ResourceError& a, const ResourceError& b); - - bool m_dataIsUpToDate; - mutable RetainPtr<NSError> m_platformError; -}; - -} // namespace WebCore - -#endif // ResourceError_h_ diff --git a/WebCore/platform/network/mac/ResourceErrorMac.mm b/WebCore/platform/network/mac/ResourceErrorMac.mm index 92f4d40..90afe01 100644 --- a/WebCore/platform/network/mac/ResourceErrorMac.mm +++ b/WebCore/platform/network/mac/ResourceErrorMac.mm @@ -1,6 +1,6 @@ // -*- mode: c++; c-basic-offset: 4 -*- /* - * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -25,9 +25,8 @@ */ #import "config.h" -#import "ResourceError.h" - #import "KURL.h" +#import "ResourceError.h" #import <Foundation/Foundation.h> @interface NSError (WebExtras) @@ -36,11 +35,8 @@ namespace WebCore { -void ResourceError::platformLazyInit() +void ResourceError::unpackPlatformError() { - if (m_dataIsUpToDate) - return; - m_domain = [m_platformError.get() domain]; m_errorCode = [m_platformError.get() code]; @@ -53,11 +49,6 @@ void ResourceError::platformLazyInit() m_dataIsUpToDate = true; } -bool ResourceError::platformCompare(const ResourceError& a, const ResourceError& b) -{ - return (NSError*)a == (NSError*)b; -} - ResourceError::operator NSError*() const { if (m_isNull) { @@ -72,9 +63,8 @@ ResourceError::operator NSError*() const [userInfo.get() setValue:m_localizedDescription forKey:NSLocalizedDescriptionKey]; if (!m_failingURL.isEmpty()) { - NSURL *cocoaURL = KURL(m_failingURL); [userInfo.get() setValue:m_failingURL forKey:@"NSErrorFailingURLStringKey"]; - [userInfo.get() setValue:cocoaURL forKey:@"NSErrorFailingURLKey"]; + [userInfo.get() setValue:KURL(m_failingURL.deprecatedString()).getNSURL() forKey:@"NSErrorFailingURLKey"]; } m_platformError.adoptNS([[NSError alloc] initWithDomain:m_domain code:m_errorCode userInfo:userInfo.get()]); @@ -84,3 +74,4 @@ ResourceError::operator NSError*() const } } // namespace WebCore + diff --git a/WebCore/platform/network/mac/ResourceRequest.h b/WebCore/platform/network/mac/ResourceRequest.h index 6d8cb6d..9f6652a 100644 --- a/WebCore/platform/network/mac/ResourceRequest.h +++ b/WebCore/platform/network/mac/ResourceRequest.h @@ -1,6 +1,6 @@ // -*- mode: c++; c-basic-offset: 4 -*- /* - * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * Redistribution and use in source and binary forms, with or without @@ -42,7 +42,7 @@ namespace WebCore { class ResourceRequest : public ResourceRequestBase { public: ResourceRequest(const String& url) - : ResourceRequestBase(KURL(url), UseProtocolCachePolicy) + : ResourceRequestBase(KURL(url.deprecatedString()), UseProtocolCachePolicy) { } diff --git a/WebCore/platform/network/mac/ResourceRequestMac.mm b/WebCore/platform/network/mac/ResourceRequestMac.mm index 6735024..1fdbd4e 100644 --- a/WebCore/platform/network/mac/ResourceRequestMac.mm +++ b/WebCore/platform/network/mac/ResourceRequestMac.mm @@ -59,7 +59,7 @@ void ResourceRequest::doUpdateResourceRequest() m_httpHeaderFields.set(name, [headers objectForKey:name]); if (NSData* bodyData = [m_nsRequest.get() HTTPBody]) - m_httpBody = FormData::create([bodyData bytes], [bodyData length]); + m_httpBody = new FormData([bodyData bytes], [bodyData length]); else if (NSInputStream* bodyStream = [m_nsRequest.get() HTTPBodyStream]) if (FormData* formData = httpBodyFromStream(bodyStream)) m_httpBody = formData; @@ -75,17 +75,15 @@ void ResourceRequest::doUpdatePlatformRequest() NSMutableURLRequest* nsRequest = [m_nsRequest.get() mutableCopy]; if (nsRequest) - [nsRequest setURL:url()]; + [nsRequest setURL:url().getNSURL()]; else - nsRequest = [[NSMutableURLRequest alloc] initWithURL:url()]; - -#ifdef BUILDING_ON_TIGER + nsRequest = [[NSMutableURLRequest alloc] initWithURL:url().getNSURL()]; + wkSupportsMultipartXMixedReplace(nsRequest); -#endif [nsRequest setCachePolicy:(NSURLRequestCachePolicy)cachePolicy()]; [nsRequest setTimeoutInterval:timeoutInterval()]; - [nsRequest setMainDocumentURL:mainDocumentURL()]; + [nsRequest setMainDocumentURL:mainDocumentURL().getNSURL()]; if (!httpMethod().isEmpty()) [nsRequest setHTTPMethod:httpMethod()]; [nsRequest setHTTPShouldHandleCookies:allowHTTPCookies()]; diff --git a/WebCore/platform/network/mac/ResourceResponse.h b/WebCore/platform/network/mac/ResourceResponse.h index 1313bae..be4f8dc 100644 --- a/WebCore/platform/network/mac/ResourceResponse.h +++ b/WebCore/platform/network/mac/ResourceResponse.h @@ -41,20 +41,16 @@ namespace WebCore { class ResourceResponse : public ResourceResponseBase { public: ResourceResponse() - : m_isUpToDate(true) + : ResourceResponseBase() { } ResourceResponse(NSURLResponse* nsResponse) - : m_nsResponse(nsResponse) - , m_isUpToDate(false) - { - m_isNull = !nsResponse; - } + : ResourceResponseBase(!nsResponse) + , m_nsResponse(nsResponse) { } ResourceResponse(const KURL& url, const String& mimeType, long long expectedLength, const String& textEncodingName, const String& filename) : ResourceResponseBase(url, mimeType, expectedLength, textEncodingName, filename) - , m_isUpToDate(true) { } @@ -63,11 +59,10 @@ public: private: friend class ResourceResponseBase; - void platformLazyInit(); - static bool platformCompare(const ResourceResponse& a, const ResourceResponse& b); + void doUpdateResourceResponse(); RetainPtr<NSURLResponse> m_nsResponse; - bool m_isUpToDate; + }; } // namespace WebCore diff --git a/WebCore/platform/network/mac/ResourceResponseMac.mm b/WebCore/platform/network/mac/ResourceResponseMac.mm index 0af5b32..58e9cf8 100644 --- a/WebCore/platform/network/mac/ResourceResponseMac.mm +++ b/WebCore/platform/network/mac/ResourceResponseMac.mm @@ -52,17 +52,13 @@ NSURLResponse *ResourceResponse::nsURLResponse() const expectedContentLength = -1; else expectedContentLength = static_cast<NSInteger>(m_expectedContentLength); - const_cast<ResourceResponse*>(this)->m_nsResponse.adoptNS([[NSURLResponse alloc] initWithURL:m_url MIMEType:m_mimeType expectedContentLength:expectedContentLength textEncodingName:m_textEncodingName]); + const_cast<ResourceResponse*>(this)->m_nsResponse.adoptNS([[NSURLResponse alloc] initWithURL:m_url.getNSURL() MIMEType:m_mimeType expectedContentLength:expectedContentLength textEncodingName:m_textEncodingName]); } return m_nsResponse.get(); } -void ResourceResponse::platformLazyInit() +void ResourceResponse::doUpdateResourceResponse() { - if (m_isUpToDate) - return; - m_isUpToDate = true; - if (m_isNull) { ASSERT(!m_nsResponse); return; @@ -108,9 +104,4 @@ void ResourceResponse::platformLazyInit() } } -bool ResourceResponse::platformCompare(const ResourceResponse& a, const ResourceResponse& b) -{ - return a.nsURLResponse() == b.nsURLResponse(); -} - } diff --git a/WebCore/platform/network/qt/AuthenticationChallenge.h b/WebCore/platform/network/qt/AuthenticationChallenge.h deleted file mode 100644 index 753ac6f..0000000 --- a/WebCore/platform/network/qt/AuthenticationChallenge.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * 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 COMPUTER, INC. ``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. - */ -#ifndef AuthenticationChallenge_h -#define AuthenticationChallenge_h - -#include "AuthenticationChallengeBase.h" - -namespace WebCore { - -class AuthenticationChallenge : public AuthenticationChallengeBase { -public: - AuthenticationChallenge() - { - } - - AuthenticationChallenge(const ProtectionSpace& protectionSpace, const Credential& proposedCredential, unsigned previousFailureCount, const ResourceResponse& response, const ResourceError& error) - : AuthenticationChallengeBase(protectionSpace, proposedCredential, previousFailureCount, response, error) - { - } -}; - -} - -#endif diff --git a/WebCore/platform/network/qt/ResourceHandleQt.cpp b/WebCore/platform/network/qt/ResourceHandleQt.cpp index 3b25f25..9037401 100644 --- a/WebCore/platform/network/qt/ResourceHandleQt.cpp +++ b/WebCore/platform/network/qt/ResourceHandleQt.cpp @@ -31,6 +31,7 @@ #include "Frame.h" #include "DocLoader.h" #include "ResourceHandle.h" +#include "DeprecatedString.h" #include "ResourceHandleClient.h" #include "ResourceHandleInternal.h" #include "qwebpage_p.h" diff --git a/WebCore/platform/network/qt/ResourceRequest.h b/WebCore/platform/network/qt/ResourceRequest.h index 6b40639..dab4ffa 100644 --- a/WebCore/platform/network/qt/ResourceRequest.h +++ b/WebCore/platform/network/qt/ResourceRequest.h @@ -37,7 +37,7 @@ namespace WebCore { struct ResourceRequest : ResourceRequestBase { ResourceRequest(const String& url) - : ResourceRequestBase(KURL(url), UseProtocolCachePolicy) + : ResourceRequestBase(KURL(url.deprecatedString()), UseProtocolCachePolicy) { } diff --git a/WebCore/platform/network/qt/ResourceResponse.h b/WebCore/platform/network/qt/ResourceResponse.h index 36b67ea..fb658c9 100644 --- a/WebCore/platform/network/qt/ResourceResponse.h +++ b/WebCore/platform/network/qt/ResourceResponse.h @@ -29,11 +29,14 @@ #include "ResourceResponseBase.h" +#include "NotImplemented.h" + namespace WebCore { class ResourceResponse : public ResourceResponseBase { public: ResourceResponse() + : ResourceResponseBase(false) { } @@ -41,6 +44,15 @@ public: : ResourceResponseBase(url, mimeType, expectedLength, textEncodingName, filename) { } + +private: + friend class ResourceResponseBase; + + void doUpdateResourceResponse() + { + notImplemented(); + } + }; } // namespace WebCore diff --git a/WebCore/platform/network/win/CookieJarWin.cpp b/WebCore/platform/network/win/CookieJarWin.cpp index 9eedcb0..2c1d58b 100644 --- a/WebCore/platform/network/win/CookieJarWin.cpp +++ b/WebCore/platform/network/win/CookieJarWin.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -24,10 +24,9 @@ */ #include "config.h" -#include "CookieJar.h" - #include "KURL.h" #include "PlatformString.h" +#include "DeprecatedString.h" #include "Document.h" #include "ResourceHandle.h" #include <windows.h> @@ -39,9 +38,8 @@ #include <Wininet.h> #endif -// FIXME: This should be broken up into CookieJarCFNet.cpp and CookieJarWin.cpp or CookieJarWinINet.cpp. - -namespace WebCore { +namespace WebCore +{ #if USE(CFNETWORK) static const CFStringRef s_setCookieKeyCF = CFSTR("Set-Cookie"); @@ -77,9 +75,11 @@ void setCookies(Document* /*document*/, const KURL& url, const KURL& policyURL, CFHTTPCookieStorageSetCookies(defaultCookieStorage, cookiesCF.get(), urlCF.get(), policyURLCF.get()); #else // FIXME: Deal with the policy URL. - String str = url.string(); - String val = value; - InternetSetCookie(str.charactersWithNullTermination(), 0, val.charactersWithNullTermination()); + DeprecatedString str = url.deprecatedString(); + str.append((UChar)'\0'); + DeprecatedString val = value.deprecatedString(); + val.append((UChar)'\0'); + InternetSetCookie((UChar*)str.unicode(), 0, (UChar*)val.unicode()); #endif } @@ -110,17 +110,19 @@ String cookies(const Document* /*document*/, const KURL& url) return (CFStringRef)CFDictionaryGetValue(headerCF.get(), s_cookieCF); #else - String str = url.string(); + DeprecatedString str = url.deprecatedString(); + str.append((UChar)'\0'); - DWORD count = str.length() + 1; - InternetGetCookie(str.charactersWithNullTermination(), 0, 0, &count); + DWORD count = str.length(); + InternetGetCookie((UChar*)str.unicode(), 0, 0, &count); if (count <= 1) // Null terminator counts as 1. return String(); - Vector<UChar> buffer(count); - InternetGetCookie(buffer.data(), 0, buffer, &count); - buffer.shrink(count - 1); // Ignore the null terminator. - return String::adopt(buffer); + UChar* buffer = new UChar[count]; + InternetGetCookie((UChar*)str.unicode(), 0, buffer, &count); + String& result = String(buffer, count-1); // Ignore the null terminator. + delete[] buffer; + return result; #endif } diff --git a/WebCore/platform/network/win/ResourceHandleWin.cpp b/WebCore/platform/network/win/ResourceHandleWin.cpp index 337b752..260652e 100644 --- a/WebCore/platform/network/win/ResourceHandleWin.cpp +++ b/WebCore/platform/network/win/ResourceHandleWin.cpp @@ -146,13 +146,13 @@ void ResourceHandle::onHandleCreated(LPARAM lParam) if (method() == "POST") { // FIXME: Too late to set referrer properly. - String urlStr = url().path(); + DeprecatedString urlStr = url().path(); int fragmentIndex = urlStr.find('#'); if (fragmentIndex != -1) urlStr = urlStr.left(fragmentIndex); static LPCSTR accept[2]={"*/*", NULL}; HINTERNET urlHandle = HttpOpenRequestA(d->m_resourceHandle, - "POST", urlStr.latin1().data(), 0, 0, accept, + "POST", urlStr.latin1(), 0, 0, accept, INTERNET_FLAG_KEEP_CONNECTION | INTERNET_FLAG_FORMS_SUBMIT | INTERNET_FLAG_RELOAD | @@ -328,12 +328,11 @@ bool ResourceHandle::start(Frame* frame) { ref(); if (url().isLocalFile()) { - String path = url().path(); + DeprecatedString path = url().path(); // windows does not enjoy a leading slash on paths if (path[0] == '/') - path = path.substring(1); - // FIXME: This is wrong. Need to use wide version of this call. - d->m_fileHandle = CreateFileA(path.utf8().data(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + path = path.mid(1); + d->m_fileHandle = CreateFileA(path.ascii(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); // FIXME: perhaps this error should be reported asynchronously for // consistency. @@ -373,15 +372,16 @@ bool ResourceHandle::start(Frame* frame) String referrer = frame->loader()->referrer(); if (method() == "POST") { d->m_postReferrer = referrer; - String host = url().host(); - urlHandle = InternetConnectA(internetHandle, host.latin1().data(), + DeprecatedString host = url().host(); + host += "\0"; + urlHandle = InternetConnectA(internetHandle, host.ascii(), url().port(), NULL, // no username NULL, // no password INTERNET_SERVICE_HTTP, flags, (DWORD_PTR)d->m_jobId); } else { - String urlStr = url().string(); + DeprecatedString urlStr = url().deprecatedString(); int fragmentIndex = urlStr.find('#'); if (fragmentIndex != -1) urlStr = urlStr.left(fragmentIndex); @@ -389,8 +389,8 @@ bool ResourceHandle::start(Frame* frame) if (!referrer.isEmpty()) headers += String("Referer: ") + referrer + "\r\n"; - urlHandle = InternetOpenUrlA(internetHandle, urlStr.latin1().data(), - headers.latin1().data(), headers.length(), + urlHandle = InternetOpenUrlA(internetHandle, urlStr.ascii(), + headers.latin1(), headers.length(), flags, (DWORD_PTR)d->m_jobId); } |