Commit d0d91260 authored by beidson's avatar beidson

WebCore:

        Reviewed by Anders

        Rewrites HTTP Authentication setting up a more platform-independent structure

        * WebCore.exp:
        * WebCore.xcodeproj/project.pbxproj:
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::didReceiveAuthenticationChallenge):
        (WebCore::FrameLoader::didCancelAuthenticationChallenge):
        * loader/FrameLoader.h:
        * loader/FrameLoaderClient.h:
        * loader/ResourceLoader.cpp:
        (WebCore::ResourceLoader::ResourceLoader):
        (WebCore::ResourceLoader::didCancel):
        * loader/ResourceLoader.h:
        (WebCore::ResourceLoader::didReceiveAuthenticationChallenge):
        (WebCore::ResourceLoader::didCancelAuthenticationChallenge):
        (WebCore::ResourceLoader::receivedCredential):
        (WebCore::ResourceLoader::receivedRequestToContinueWithoutCredential):
        (WebCore::ResourceLoader::receivedCancellation):
        * loader/mac/FrameLoaderMac.mm:
        * loader/mac/ResourceLoaderMac.mm:
        (WebCore::ResourceLoader::didReceiveAuthenticationChallenge):
        (WebCore::ResourceLoader::didCancelAuthenticationChallenge):
        (WebCore::ResourceLoader::receivedCredential):
        (WebCore::ResourceLoader::receivedRequestToContinueWithoutCredential):
        (WebCore::ResourceLoader::receivedCancellation):
        * platform/graphics/svg/SVGImageEmptyClients.h:
        (WebCore::SVGEmptyFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge):
        (WebCore::SVGEmptyFrameLoaderClient::dispatchDidCancelAuthenticationChallenge):
        * platform/network/ResourceHandleClient.h:
        (WebCore::ResourceHandleClient::willSendRequest):
        (WebCore::ResourceHandleClient::didReceiveAuthenticationChallenge):
        (WebCore::ResourceHandleClient::didCancelAuthenticationChallenge):
        (WebCore::ResourceHandleClient::receivedCredential):
        (WebCore::ResourceHandleClient::receivedRequestToContinueWithoutCredential):
        (WebCore::ResourceHandleClient::receivedCancellation):
        (WebCore::ResourceHandleClient::willCacheResponse):
        * platform/network/ResourceResponse.h:
        (WebCore::operator!=):
        * platform/network/URLAuthenticationChallenge.cpp: Added.
        (WebCore::URLAuthenticationChallenge::URLAuthenticationChallenge):
        (WebCore::URLAuthenticationChallenge::previousFailureCount):
        (WebCore::URLAuthenticationChallenge::proposedCredential):
        (WebCore::URLAuthenticationChallenge::protectionSpace):
        (WebCore::URLAuthenticationChallenge::failureResponse):
        (WebCore::URLAuthenticationChallenge::error):
        (WebCore::URLAuthenticationChallenge::isNull):
        (WebCore::URLAuthenticationChallenge::nullify):
        (WebCore::operator==):
        (WebCore::operator!=):
        * platform/network/URLAuthenticationChallenge.h: Added.
        (WebCore::URLAuthenticationChallenge::sender):
        (WebCore::URLAuthenticationChallenge::nsURLAuthenticationChallenge):
        * platform/network/URLCredential.cpp: Added.
        (WebCore::URLCredential::URLCredential):
        (WebCore::URLCredential::user):
        (WebCore::URLCredential::password):
        (WebCore::URLCredential::hasPassword):
        (WebCore::URLCredential::persistence):
        (WebCore::operator==):
        * platform/network/URLCredential.h: Added.
        (WebCore::):
        (WebCore::operator!=):
        * platform/network/URLProtectionSpace.cpp: Added.
        (WebCore::URLProtectionSpace::URLProtectionSpace):
        (WebCore::URLProtectionSpace::host):
        (WebCore::URLProtectionSpace::port):
        (WebCore::URLProtectionSpace::serverType):
        (WebCore::URLProtectionSpace::realm):
        (WebCore::URLProtectionSpace::authenticationScheme):
        (WebCore::operator==):
        * platform/network/URLProtectionSpace.h: Added.
        (WebCore::):
        (WebCore::operator!=):
        * platform/network/mac/AuthenticationMac.h: Added.
        * platform/network/mac/AuthenticationMac.mm: Added.
        (WebCore::URLAuthenticationChallenge::URLAuthenticationChallenge):
        (WebCore::mac):
        (WebCore::core):
        * platform/network/mac/ResourceHandleMac.mm:
        (-[WebCoreResourceHandleAsDelegate connection:didReceiveAuthenticationChallenge:]):
        (-[WebCoreResourceHandleAsDelegate connection:didCancelAuthenticationChallenge:]):
        (-[WebCoreResourceHandleAsDelegate useCredential:forAuthenticationChallenge:]):
        (-[WebCoreResourceHandleAsDelegate continueWithoutCredentialForAuthenticationChallenge:]):
        (-[WebCoreResourceHandleAsDelegate cancelAuthenticationChallenge:]):
        * platform/network/mac/ResourceResponseMac.mm:
        (WebCore::operator==):

WebKit:

        Reviewed by Anders

        Rewrites HTTP Authentication setting up a more platform-independent structure

        * WebCoreSupport/WebFrameLoaderClient.h:
        * WebCoreSupport/WebFrameLoaderClient.mm:
        (WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge):
        (WebFrameLoaderClient::dispatchDidCancelAuthenticationChallenge):
        * WebKit.xcodeproj/project.pbxproj:

WebKitQt:

        Keep the fancy new FrameLoaderClientQt building with a small api change in WebCore
        Yay for the loader on QT!

        * WebCoreSupport/FrameLoaderClientQt.cpp:
        (WebCore::FrameLoaderClientQt::dispatchDidReceiveAuthenticationChallenge):
        (WebCore::FrameLoaderClientQt::dispatchDidCancelAuthenticationChallenge):
        * WebCoreSupport/FrameLoaderClientQt.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@18783 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ec60d104
2007-01-11 Brady Eidson <beidson@apple.com>
Reviewed by Anders
Rewrites HTTP Authentication setting up a more platform-independent structure
* WebCore.exp:
* WebCore.xcodeproj/project.pbxproj:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::didReceiveAuthenticationChallenge):
(WebCore::FrameLoader::didCancelAuthenticationChallenge):
* loader/FrameLoader.h:
* loader/FrameLoaderClient.h:
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::ResourceLoader):
(WebCore::ResourceLoader::didCancel):
* loader/ResourceLoader.h:
(WebCore::ResourceLoader::didReceiveAuthenticationChallenge):
(WebCore::ResourceLoader::didCancelAuthenticationChallenge):
(WebCore::ResourceLoader::receivedCredential):
(WebCore::ResourceLoader::receivedRequestToContinueWithoutCredential):
(WebCore::ResourceLoader::receivedCancellation):
* loader/mac/FrameLoaderMac.mm:
* loader/mac/ResourceLoaderMac.mm:
(WebCore::ResourceLoader::didReceiveAuthenticationChallenge):
(WebCore::ResourceLoader::didCancelAuthenticationChallenge):
(WebCore::ResourceLoader::receivedCredential):
(WebCore::ResourceLoader::receivedRequestToContinueWithoutCredential):
(WebCore::ResourceLoader::receivedCancellation):
* platform/graphics/svg/SVGImageEmptyClients.h:
(WebCore::SVGEmptyFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge):
(WebCore::SVGEmptyFrameLoaderClient::dispatchDidCancelAuthenticationChallenge):
* platform/network/ResourceHandleClient.h:
(WebCore::ResourceHandleClient::willSendRequest):
(WebCore::ResourceHandleClient::didReceiveAuthenticationChallenge):
(WebCore::ResourceHandleClient::didCancelAuthenticationChallenge):
(WebCore::ResourceHandleClient::receivedCredential):
(WebCore::ResourceHandleClient::receivedRequestToContinueWithoutCredential):
(WebCore::ResourceHandleClient::receivedCancellation):
(WebCore::ResourceHandleClient::willCacheResponse):
* platform/network/ResourceResponse.h:
(WebCore::operator!=):
* platform/network/URLAuthenticationChallenge.cpp: Added.
(WebCore::URLAuthenticationChallenge::URLAuthenticationChallenge):
(WebCore::URLAuthenticationChallenge::previousFailureCount):
(WebCore::URLAuthenticationChallenge::proposedCredential):
(WebCore::URLAuthenticationChallenge::protectionSpace):
(WebCore::URLAuthenticationChallenge::failureResponse):
(WebCore::URLAuthenticationChallenge::error):
(WebCore::URLAuthenticationChallenge::isNull):
(WebCore::URLAuthenticationChallenge::nullify):
(WebCore::operator==):
(WebCore::operator!=):
* platform/network/URLAuthenticationChallenge.h: Added.
(WebCore::URLAuthenticationChallenge::sender):
(WebCore::URLAuthenticationChallenge::nsURLAuthenticationChallenge):
* platform/network/URLCredential.cpp: Added.
(WebCore::URLCredential::URLCredential):
(WebCore::URLCredential::user):
(WebCore::URLCredential::password):
(WebCore::URLCredential::hasPassword):
(WebCore::URLCredential::persistence):
(WebCore::operator==):
* platform/network/URLCredential.h: Added.
(WebCore::):
(WebCore::operator!=):
* platform/network/URLProtectionSpace.cpp: Added.
(WebCore::URLProtectionSpace::URLProtectionSpace):
(WebCore::URLProtectionSpace::host):
(WebCore::URLProtectionSpace::port):
(WebCore::URLProtectionSpace::serverType):
(WebCore::URLProtectionSpace::realm):
(WebCore::URLProtectionSpace::authenticationScheme):
(WebCore::operator==):
* platform/network/URLProtectionSpace.h: Added.
(WebCore::):
(WebCore::operator!=):
* platform/network/mac/AuthenticationMac.h: Added.
* platform/network/mac/AuthenticationMac.mm: Added.
(WebCore::URLAuthenticationChallenge::URLAuthenticationChallenge):
(WebCore::mac):
(WebCore::core):
* platform/network/mac/ResourceHandleMac.mm:
(-[WebCoreResourceHandleAsDelegate connection:didReceiveAuthenticationChallenge:]):
(-[WebCoreResourceHandleAsDelegate connection:didCancelAuthenticationChallenge:]):
(-[WebCoreResourceHandleAsDelegate useCredential:forAuthenticationChallenge:]):
(-[WebCoreResourceHandleAsDelegate continueWithoutCredentialForAuthenticationChallenge:]):
(-[WebCoreResourceHandleAsDelegate cancelAuthenticationChallenge:]):
* platform/network/mac/ResourceResponseMac.mm:
(WebCore::operator==):
2007-01-11 Geoffrey Garen <ggaren@apple.com>
Reviewed by Anders Carlsson.
......
......@@ -556,6 +556,7 @@ __ZNK7WebCore9Selection17isContentEditableEv
__ZNK7WebCore9Selection23isContentRichlyEditableEv
__ZNK7WebCore9Selection7toRangeEv
__ZNK7WebCore9TimerBase8isActiveEv
__ZN7WebCore3macERKNS_23AuthenticationChallengeE
_canonicalURL
_stringIsFileURL
_urlByRemovingComponent
......
......@@ -295,9 +295,17 @@
4E19592E0A39DACC00220FE5 /* MediaQueryExp.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E1959280A39DACC00220FE5 /* MediaQueryExp.h */; };
510184690B08602A004A825F /* PageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 510184670B08602A004A825F /* PageCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
5101846A0B08602A004A825F /* PageCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510184680B08602A004A825F /* PageCache.cpp */; };
510F735F0B56C08800A3002A /* AuthenticationChallenge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510F73590B56C08800A3002A /* AuthenticationChallenge.cpp */; };
510F73600B56C08800A3002A /* AuthenticationChallenge.h in Headers */ = {isa = PBXBuildFile; fileRef = 510F735A0B56C08800A3002A /* AuthenticationChallenge.h */; settings = {ATTRIBUTES = (Private, ); }; };
510F73610B56C08800A3002A /* Credential.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510F735B0B56C08800A3002A /* Credential.cpp */; };
510F73620B56C08800A3002A /* Credential.h in Headers */ = {isa = PBXBuildFile; fileRef = 510F735C0B56C08800A3002A /* Credential.h */; settings = {ATTRIBUTES = (Private, ); }; };
510F73630B56C08800A3002A /* ProtectionSpace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510F735D0B56C08800A3002A /* ProtectionSpace.cpp */; };
510F73640B56C08800A3002A /* ProtectionSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = 510F735E0B56C08800A3002A /* ProtectionSpace.h */; settings = {ATTRIBUTES = (Private, ); }; };
5115095C0A9CE04700901013 /* urlIcon.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 5115095B0A9CE04600901013 /* urlIcon.tiff */; };
5126E6BB0A2E3B12005C29FA /* IconDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5126E6B90A2E3B12005C29FA /* IconDatabase.cpp */; };
5126E6BC0A2E3B12005C29FA /* IconDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 5126E6BA0A2E3B12005C29FA /* IconDatabase.h */; settings = {ATTRIBUTES = (Private, ); }; };
513BF1080B4F558900CCFECE /* AuthenticationMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 513BF1070B4F558900CCFECE /* AuthenticationMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
513BF1280B4F57DC00CCFECE /* AuthenticationMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 513BF1270B4F57DC00CCFECE /* AuthenticationMac.mm */; };
513F14530AB634C400094DDF /* IconLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 513F14510AB634C400094DDF /* IconLoader.cpp */; };
513F14540AB634C400094DDF /* IconLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 513F14520AB634C400094DDF /* IconLoader.h */; };
5160F1FE0B0A7EF400C1D2AF /* HistoryItemTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5160F1FC0B0A7EF400C1D2AF /* HistoryItemTimer.h */; };
......@@ -3319,9 +3327,17 @@
4E1959280A39DACC00220FE5 /* MediaQueryExp.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MediaQueryExp.h; sourceTree = "<group>"; };
510184670B08602A004A825F /* PageCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageCache.h; sourceTree = "<group>"; };
510184680B08602A004A825F /* PageCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageCache.cpp; sourceTree = "<group>"; };
510F73590B56C08800A3002A /* AuthenticationChallenge.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AuthenticationChallenge.cpp; sourceTree = "<group>"; };
510F735A0B56C08800A3002A /* AuthenticationChallenge.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AuthenticationChallenge.h; sourceTree = "<group>"; };
510F735B0B56C08800A3002A /* Credential.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Credential.cpp; sourceTree = "<group>"; };
510F735C0B56C08800A3002A /* Credential.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Credential.h; sourceTree = "<group>"; };
510F735D0B56C08800A3002A /* ProtectionSpace.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ProtectionSpace.cpp; sourceTree = "<group>"; };
510F735E0B56C08800A3002A /* ProtectionSpace.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ProtectionSpace.h; sourceTree = "<group>"; };
5115095B0A9CE04600901013 /* urlIcon.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = urlIcon.tiff; sourceTree = "<group>"; };
5126E6B90A2E3B12005C29FA /* IconDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IconDatabase.cpp; sourceTree = "<group>"; };
5126E6BA0A2E3B12005C29FA /* IconDatabase.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IconDatabase.h; sourceTree = "<group>"; };
513BF1070B4F558900CCFECE /* AuthenticationMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticationMac.h; sourceTree = "<group>"; };
513BF1270B4F57DC00CCFECE /* AuthenticationMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AuthenticationMac.mm; sourceTree = "<group>"; };
513F14510AB634C400094DDF /* IconLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IconLoader.cpp; sourceTree = "<group>"; };
513F14520AB634C400094DDF /* IconLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IconLoader.h; sourceTree = "<group>"; };
5150C2A10702629000AF642C /* WebDashboardRegion.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDashboardRegion.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
......@@ -6640,6 +6656,10 @@
isa = PBXGroup;
children = (
656B84E70AEA1DAE00A095B4 /* mac */,
510F73590B56C08800A3002A /* AuthenticationChallenge.cpp */,
510F735A0B56C08800A3002A /* AuthenticationChallenge.h */,
510F735B0B56C08800A3002A /* Credential.cpp */,
510F735C0B56C08800A3002A /* Credential.h */,
65DADA170AFD878000CE53ED /* FormData.h */,
65DAD9FA0AFD86B400CE53ED /* FormData.cpp */,
651888860AFF3BF700164720 /* ResourceError.cpp */,
......@@ -6647,14 +6667,16 @@
655A81BD0AEF67E6000975F0 /* HTTPHeaderMap.h */,
E1D8E3150B29E39C00F4BAF6 /* HTTPParsers.h */,
E1D8E3190B29E3B600F4BAF6 /* HTTPParsers.cpp */,
510F735D0B56C08800A3002A /* ProtectionSpace.cpp */,
510F735E0B56C08800A3002A /* ProtectionSpace.h */,
656B85370AEA1F9A00A095B4 /* ResourceHandle.h */,
656B84DC0AEA1D3100A095B4 /* ResourceHandle.cpp */,
656B84DE0AEA1D3100A095B4 /* ResourceHandleClient.h */,
656B84DF0AEA1D3100A095B4 /* ResourceHandleInternal.h */,
1AD8CFCD0B1CED8900696DE0 /* ResourceRequest.cpp */,
6522BCDE09C9DAA800C9BA7A /* ResourceRequest.h */,
1A8180A40B1D4E4300CE46C4 /* ResourceResponse.cpp */,
1AD8CFCD0B1CED8900696DE0 /* ResourceRequest.cpp */,
658821650AF4CDF700F01D1F /* ResourceResponse.h */,
1A8180A40B1D4E4300CE46C4 /* ResourceResponse.cpp */,
);
path = network;
sourceTree = "<group>";
......@@ -6668,6 +6690,8 @@
656B84EA0AEA1DDA00A095B4 /* ResourceHandleMac.mm */,
650E3F680AF6C168001FA3AD /* ResourceRequestMac.mm */,
658821690AF4CE1200F01D1F /* ResourceResponseMac.mm */,
513BF1070B4F558900CCFECE /* AuthenticationMac.h */,
513BF1270B4F57DC00CCFECE /* AuthenticationMac.mm */,
);
path = mac;
sourceTree = "<group>";
......@@ -10920,9 +10944,13 @@
A82422700B4A16C50084722B /* SVGAnimateMotionElement.h in Headers */,
062287840B4DB322000C34DF /* FocusDirection.h in Headers */,
1A4A954E0B4EDCCB002D8C3C /* SharedBuffer.h in Headers */,
513BF1080B4F558900CCFECE /* AuthenticationMac.h in Headers */,
BCCFBAE80B5152ED0001F1D7 /* Tokenizer.h in Headers */,
AA882B300B4EF5EB006D26D1 /* PointerEventsHitRules.h in Headers */,
93C7B5F40B52D89100B5477E /* CharacterNames.h in Headers */,
510F73600B56C08800A3002A /* AuthenticationChallenge.h in Headers */,
510F73620B56C08800A3002A /* Credential.h in Headers */,
510F73640B56C08800A3002A /* ProtectionSpace.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -12250,7 +12278,11 @@
A82422710B4A16C50084722B /* SVGAnimateMotionElement.cpp in Sources */,
1A4A954D0B4EDCCB002D8C3C /* SharedBuffer.cpp in Sources */,
1A4A95520B4EDCFF002D8C3C /* SharedBufferMac.mm in Sources */,
513BF1280B4F57DC00CCFECE /* AuthenticationMac.mm in Sources */,
AA882B2F0B4EF5EB006D26D1 /* PointerEventsHitRules.cpp in Sources */,
510F735F0B56C08800A3002A /* AuthenticationChallenge.cpp in Sources */,
510F73610B56C08800A3002A /* Credential.cpp in Sources */,
510F73630B56C08800A3002A /* ProtectionSpace.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -4053,6 +4053,16 @@ PassRefPtr<SharedBuffer> FrameLoader::mainResourceData() const
return m_mainResourceLoader->resourceData();
}
void FrameLoader::didReceiveAuthenticationChallenge(ResourceLoader* loader, const AuthenticationChallenge& currentWebChallenge)
{
m_client->dispatchDidReceiveAuthenticationChallenge(activeDocumentLoader(), loader->identifier(), currentWebChallenge);
}
void FrameLoader::didCancelAuthenticationChallenge(ResourceLoader* loader, const AuthenticationChallenge& currentWebChallenge)
{
m_client->dispatchDidCancelAuthenticationChallenge(activeDocumentLoader(), loader->identifier(), currentWebChallenge);
}
PolicyCheck::PolicyCheck()
: m_navigationFunction(0)
, m_newWindowFunction(0)
......
......@@ -67,6 +67,7 @@ namespace KJS {
namespace WebCore {
class AuthenticationChallenge;
class DocumentLoader;
class Element;
class Event;
......@@ -211,13 +212,12 @@ namespace WebCore {
DocumentLoader* provisionalDocumentLoader();
FrameState state() const;
static double timeOfLastCompletedLoad();
void didReceiveAuthenticationChallenge(ResourceLoader*, const AuthenticationChallenge&);
void didCancelAuthenticationChallenge(ResourceLoader*, const AuthenticationChallenge&);
id identifierForInitialRequest(const ResourceRequest&);
void willSendRequest(ResourceLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
#if PLATFORM(MAC)
void didReceiveAuthenticationChallenge(ResourceLoader*, NSURLAuthenticationChallenge *);
void didCancelAuthenticationChallenge(ResourceLoader*, NSURLAuthenticationChallenge *);
#endif
void didReceiveResponse(ResourceLoader*, const ResourceResponse&);
void didReceiveData(ResourceLoader*, const char*, int, int lengthReceived);
void didFinishLoad(ResourceLoader*);
......
......@@ -46,6 +46,7 @@ typedef void* id;
namespace WebCore {
class AuthenticationChallenge;
class DocumentLoader;
class Element;
class FormState;
......@@ -55,12 +56,12 @@ namespace WebCore {
class KURL;
class NavigationAction;
class PageCache;
class String;
class ResourceError;
class ResourceHandle;
class ResourceLoader;
class ResourceRequest;
class ResourceResponse;
class String;
typedef void (FrameLoader::*FramePolicyFunction)(PolicyAction);
......@@ -89,16 +90,10 @@ namespace WebCore {
virtual void loadedFromPageCache() = 0;
virtual void download(ResourceHandle*, const ResourceRequest&, const ResourceResponse&) = 0;
virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, id identifier, const AuthenticationChallenge&) = 0;
virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, id identifier, const AuthenticationChallenge&) = 0;
#if PLATFORM(MAC)
virtual id dispatchIdentifierForInitialRequest(DocumentLoader*, const ResourceRequest&) = 0;
#endif
virtual void dispatchWillSendRequest(DocumentLoader*, id identifier, ResourceRequest&, const ResourceResponse& redirectResponse) = 0;
#if PLATFORM(MAC)
virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, id identifier, NSURLAuthenticationChallenge *) = 0;
virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, id identifier, NSURLAuthenticationChallenge *) = 0;
#endif
virtual void dispatchDidReceiveResponse(DocumentLoader*, id identifier, const ResourceResponse&) = 0;
virtual void dispatchDidReceiveContentLength(DocumentLoader*, id identifier, int lengthReceived) = 0;
virtual void dispatchDidFinishLoading(DocumentLoader*, id identifier) = 0;
......@@ -194,6 +189,11 @@ namespace WebCore {
virtual void saveDocumentViewToPageCache(PageCache*) = 0;
virtual bool canCachePage() const = 0;
virtual void download(ResourceHandle*, const ResourceRequest&, const ResourceResponse&) = 0;
#if PLATFORM(MAC)
virtual id dispatchIdentifierForInitialRequest(DocumentLoader*, const ResourceRequest&) = 0;
#endif
};
} // namespace WebCore
......
......@@ -55,7 +55,7 @@ ResourceLoader::ResourceLoader(Frame* frame)
, m_calledDidFinishLoad(false)
, m_frame(frame)
#if PLATFORM(MAC)
, m_currentConnectionChallenge(nil)
, m_currentMacChallenge(nil)
#endif
, m_defersLoading(frame->page()->defersLoading())
{
......@@ -255,9 +255,10 @@ void ResourceLoader::didCancel(const ResourceError& error)
m_cancelled = true;
#if PLATFORM(MAC)
m_currentConnectionChallenge = nil;
m_currentWebChallenge = nil;
m_currentMacChallenge = nil;
#endif
m_currentWebChallenge.nullify();
frameLoader()->cancelPendingArchiveLoad(this);
if (m_handle) {
......
......@@ -34,6 +34,7 @@
#include "ResourceResponse.h"
#include "ResourceLoader.h"
#include "Shared.h"
#include "AuthenticationChallenge.h"
#include "KURL.h"
#include <wtf/Forward.h>
......@@ -93,7 +94,7 @@ namespace WebCore {
virtual void addData(const char*, int, bool allAtOnce);
virtual PassRefPtr<SharedBuffer> resourceData();
void clearResourceData();
virtual void willSendRequest(ResourceRequest&, const ResourceResponse& redirectResponse);
virtual void didReceiveResponse(const ResourceResponse&);
virtual void didReceiveData(const char*, int, long long lengthReceived, bool allAtOnce);
......@@ -101,13 +102,7 @@ namespace WebCore {
virtual void didFinishLoading();
virtual void didFail(const ResourceError&);
#if PLATFORM(MAC)
void didReceiveAuthenticationChallenge(NSURLAuthenticationChallenge *);
void didCancelAuthenticationChallenge(NSURLAuthenticationChallenge *);
NSCachedURLResponse *willCacheResponse(NSCachedURLResponse *);
void receivedCredential(NSURLAuthenticationChallenge *, NSURLCredential *);
void receivedRequestToContinueWithoutCredential(NSURLAuthenticationChallenge *);
void receivedCancellation(NSURLAuthenticationChallenge *);
#endif
// ResourceHandleClient
......@@ -116,19 +111,22 @@ namespace WebCore {
virtual void didReceiveData(ResourceHandle*, const char*, int, int lengthReceived);
virtual void didFinishLoading(ResourceHandle*);
virtual void didFail(ResourceHandle*, const ResourceError&);
virtual void willStopBufferingData(ResourceHandle*, const char* data, int length) { willStopBufferingData(data, length); }
#if PLATFORM(MAC)
virtual void didReceiveAuthenticationChallenge(ResourceHandle*, NSURLAuthenticationChallenge *challenge) { didReceiveAuthenticationChallenge(challenge); }
virtual void didCancelAuthenticationChallenge(ResourceHandle*, NSURLAuthenticationChallenge *challenge) { didCancelAuthenticationChallenge(challenge); }
virtual NSCachedURLResponse *willCacheResponse(ResourceHandle*, NSCachedURLResponse *cachedResponse) { return willCacheResponse(cachedResponse); }
virtual void receivedCredential(ResourceHandle*, NSURLAuthenticationChallenge *challenge, NSURLCredential *credential) { receivedCredential(challenge, credential); }
virtual void receivedRequestToContinueWithoutCredential(ResourceHandle*, NSURLAuthenticationChallenge *challenge) { receivedRequestToContinueWithoutCredential(challenge); }
virtual void receivedCancellation(ResourceHandle*, NSURLAuthenticationChallenge *challenge) { receivedCancellation(challenge); }
void didReceiveAuthenticationChallenge(const AuthenticationChallenge& challenge);
void didCancelAuthenticationChallenge(const AuthenticationChallenge& challenge);
void receivedCredential(const AuthenticationChallenge&, const Credential&);
void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&);
void receivedCancellation(const AuthenticationChallenge&);
virtual void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge& challenge) { didReceiveAuthenticationChallenge(challenge); }
virtual void didCancelAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge& challenge) { didCancelAuthenticationChallenge(challenge); }
virtual void receivedCredential(ResourceHandle*, const AuthenticationChallenge& challenge, const Credential& credential) { receivedCredential(challenge, credential); }
virtual void receivedRequestToContinueWithoutCredential(ResourceHandle*, const AuthenticationChallenge& challenge) { receivedRequestToContinueWithoutCredential(challenge); }
virtual void receivedCancellation(ResourceHandle*, const AuthenticationChallenge& challenge) { receivedCancellation(challenge); }
#endif
ResourceHandle* handle() const { return m_handle.get(); }
......@@ -146,7 +144,7 @@ namespace WebCore {
bool defersLoading() const { return m_defersLoading; }
RefPtr<ResourceHandle> m_handle;
private:
ResourceRequest m_request;
......@@ -160,9 +158,10 @@ protected:
ResourceResponse m_response;
#if PLATFORM(MAC)
RetainPtr<id> m_identifier;
NSURLAuthenticationChallenge *m_currentConnectionChallenge;
RetainPtr<NSURLAuthenticationChallenge> m_currentWebChallenge;
NSURLAuthenticationChallenge *m_currentMacChallenge;
#endif
AuthenticationChallenge m_currentWebChallenge;
KURL m_originalURL;
RefPtr<SharedBuffer> m_resourceData;
bool m_defersLoading;
......
......@@ -171,16 +171,6 @@ String FrameLoader::referrer() const
return documentLoader()->request().httpReferrer();
}
void FrameLoader::didReceiveAuthenticationChallenge(ResourceLoader* loader, NSURLAuthenticationChallenge *currentWebChallenge)
{
m_client->dispatchDidReceiveAuthenticationChallenge(activeDocumentLoader(), loader->identifier(), currentWebChallenge);
}
void FrameLoader::didCancelAuthenticationChallenge(ResourceLoader* loader, NSURLAuthenticationChallenge *currentWebChallenge)
{
m_client->dispatchDidCancelAuthenticationChallenge(activeDocumentLoader(), loader->identifier(), currentWebChallenge);
}
void FrameLoader::didChangeTitle(DocumentLoader* loader)
{
m_client->didChangeTitle(loader);
......
......@@ -29,6 +29,7 @@
#import "config.h"
#import "ResourceLoader.h"
#import "AuthenticationMac.h"
#import "FrameLoader.h"
#import "FrameMac.h"
#import "Page.h"
......@@ -53,37 +54,40 @@ using namespace WebCore;
namespace WebCore {
void ResourceLoader::didReceiveAuthenticationChallenge(NSURLAuthenticationChallenge *challenge)
void ResourceLoader::didReceiveAuthenticationChallenge(const AuthenticationChallenge& challenge)
{
ASSERT(!m_reachedTerminalState);
ASSERT(!m_currentConnectionChallenge);
ASSERT(!m_currentWebChallenge);
ASSERT(!m_currentMacChallenge);
ASSERT(m_currentWebChallenge.isNull());
// Since NSURLConnection networking relies on keeping a reference to the original NSURLAuthenticationChallenge,
// we make sure that is actually present
ASSERT(challenge.nsURLAuthenticationChallenge());
// Protect this in this delegate method since the additional processing can do
// anything including possibly derefing this; one example of this is Radar 3266216.
RefPtr<ResourceLoader> protector(this);
m_currentConnectionChallenge = challenge;
NSURLAuthenticationChallenge *webChallenge = [[NSURLAuthenticationChallenge alloc] initWithAuthenticationChallenge:challenge sender:(id<NSURLAuthenticationChallengeSender>)m_handle->delegate()];
m_currentWebChallenge = webChallenge;
frameLoader()->didReceiveAuthenticationChallenge(this, webChallenge);
m_currentMacChallenge = challenge.nsURLAuthenticationChallenge();
NSURLAuthenticationChallenge *webChallenge = [[NSURLAuthenticationChallenge alloc] initWithAuthenticationChallenge:m_currentMacChallenge
sender:(id<NSURLAuthenticationChallengeSender>)m_handle->delegate()];
m_currentWebChallenge = core(webChallenge);
[webChallenge release];
frameLoader()->didReceiveAuthenticationChallenge(this, m_currentWebChallenge);
}
void ResourceLoader::didCancelAuthenticationChallenge(NSURLAuthenticationChallenge *challenge)
void ResourceLoader::didCancelAuthenticationChallenge(const AuthenticationChallenge& challenge)
{
ASSERT(!m_reachedTerminalState);
ASSERT(m_currentConnectionChallenge);
ASSERT(m_currentWebChallenge);
ASSERT(m_currentConnectionChallenge == challenge);
ASSERT(m_currentMacChallenge);
ASSERT(!m_currentWebChallenge.isNull());
ASSERT(m_currentWebChallenge == challenge);
// Protect this in this delegate method since the additional processing can do
// anything including possibly derefing this; one example of this is Radar 3266216.
RefPtr<ResourceLoader> protector(this);
frameLoader()->didCancelAuthenticationChallenge(this, m_currentWebChallenge.get());
frameLoader()->didCancelAuthenticationChallenge(this, m_currentWebChallenge);
}
NSCachedURLResponse *ResourceLoader::willCacheResponse(NSCachedURLResponse *cachedResponse)
......@@ -103,31 +107,31 @@ void ResourceLoader::setIdentifier(id identifier)
}
void ResourceLoader::receivedCredential(NSURLAuthenticationChallenge *challenge, NSURLCredential *credential)
void ResourceLoader::receivedCredential(const AuthenticationChallenge& challenge, const Credential& credential)
{
ASSERT(challenge);
ASSERT(!challenge.isNull());
if (challenge != m_currentWebChallenge)
return;
[[m_currentConnectionChallenge sender] useCredential:credential forAuthenticationChallenge:m_currentConnectionChallenge];
[[m_currentMacChallenge sender] useCredential:mac(credential) forAuthenticationChallenge:m_currentMacChallenge];
m_currentConnectionChallenge = nil;
m_currentWebChallenge = nil;
m_currentMacChallenge = nil;
m_currentWebChallenge.nullify();
}
void ResourceLoader::receivedRequestToContinueWithoutCredential(NSURLAuthenticationChallenge *challenge)
void ResourceLoader::receivedRequestToContinueWithoutCredential(const AuthenticationChallenge& challenge)
{
ASSERT(challenge);
ASSERT(!challenge.isNull());
if (challenge != m_currentWebChallenge)
return;
[[m_currentConnectionChallenge sender] continueWithoutCredentialForAuthenticationChallenge:m_currentConnectionChallenge];
[[m_currentMacChallenge sender] continueWithoutCredentialForAuthenticationChallenge:m_currentMacChallenge];
m_currentConnectionChallenge = nil;
m_currentWebChallenge = nil;
m_currentMacChallenge = nil;
m_currentWebChallenge.nullify();
}
void ResourceLoader::receivedCancellation(NSURLAuthenticationChallenge *challenge)
void ResourceLoader::receivedCancellation(const AuthenticationChallenge& challenge)
{
if (challenge != m_currentWebChallenge)
return;
......
......@@ -143,8 +143,8 @@ public:
virtual id dispatchIdentifierForInitialRequest(DocumentLoader*, const ResourceRequest&) { return 0; }
virtual void dispatchWillSendRequest(DocumentLoader*, id identifier, ResourceRequest&, const ResourceResponse& redirectResponse) { }
virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, id identifier, NSURLAuthenticationChallenge *) { }
virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, id identifier, NSURLAuthenticationChallenge *) { }
virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, id identifier, const AuthenticationChallenge&) { }
virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, id identifier, const AuthenticationChallenge&) { }
virtual void dispatchDidReceiveResponse(DocumentLoader*, id identifier, const ResourceResponse&) { }
virtual void dispatchDidReceiveContentLength(DocumentLoader*, id identifier, int lengthReceived) { }
virtual void dispatchDidFinishLoading(DocumentLoader*, id identifier) { }
......
/*
* 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.
*/
#include "config.h"
#include "AuthenticationChallenge.h"
namespace WebCore {
AuthenticationChallenge::AuthenticationChallenge()
: m_isNull(true)
, m_previousFailureCount(0)
{
}
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)
, m_previousFailureCount(previousFailureCount)
, m_failureResponse(response)
, m_error(error)
{
}
unsigned AuthenticationChallenge::previousFailureCount() const
{
return m_previousFailureCount;
}
const Credential& AuthenticationChallenge::proposedCredential() const
{
return m_proposedCredential;
}
const ProtectionSpace& AuthenticationChallenge::protectionSpace() const
{
return m_protectionSpace;
}
const ResourceResponse& AuthenticationChallenge::failureResponse() const
{
return m_failureResponse;
}
const ResourceError& AuthenticationChallenge::error() const
{
return m_error;
}
bool AuthenticationChallenge::isNull() const
{
return m_isNull;
}
void AuthenticationChallenge::nullify()
{
m_isNull = true;
}
bool operator==(const AuthenticationChallenge& a, const AuthenticationChallenge& b)
{
if (a.isNull() != b.isNull())
return false;
if (a.isNull())
return true;
#if PLATFORM(MAC)
if (a.sender() != b.sender())
return false;
if (a.nsURLAuthenticationChallenge() != b.nsURLAuthenticationChallenge())
return false;
#endif
if (a.protectionSpace() != b.protectionSpace())
return false;
if (a.proposedCredential() != b.proposedCredential())
return false;
if (a.previousFailureCount() != b.previousFailureCount())
return false;
if (a.failureResponse() != b.failureResponse())
return false;
if (a.error() != b.error())
return false;
return true;
}
bool operator!=(const AuthenticationChallenge& a, const AuthenticationChallenge& b)
{
return !(a == b);
}
}