Changeset 91799 in webkit


Ignore:
Timestamp:
Jul 26, 2011 4:43:15 PM (13 years ago)
Author:
psolanki@apple.com
Message:

Add protection space authentication callback code to CFNetwork loader on Mac
https://bugs.webkit.org/show_bug.cgi?id=65190
<rdar://problem/9842424>

Reviewed by Oliver Hunt.

Port over protection space authentication callback code from ResourceHandleMac.mm to
ResourceHandleCFNet.cpp.

  • platform/network/ResourceHandle.h:
  • platform/network/cf/ResourceHandleCFNet.cpp:

(WebCore::canRespondToProtectionSpace):
(WebCore::ResourceHandle::createCFURLConnection):
(WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace):
(WebCore::WebCoreSynchronousLoaderClient::canAuthenticateAgainstProtectionSpace):

  • platform/network/mac/ResourceHandleMac.mm:

(-[WebCoreResourceHandleAsDelegate connection:canAuthenticateAgainstProtectionSpace:]): Add logging.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r91797 r91799  
     12011-07-26  Pratik Solanki  <psolanki@apple.com>
     2
     3        Add protection space authentication callback code to CFNetwork loader on Mac
     4        https://bugs.webkit.org/show_bug.cgi?id=65190
     5        <rdar://problem/9842424>
     6
     7        Reviewed by Oliver Hunt.
     8
     9        Port over protection space authentication callback code from ResourceHandleMac.mm to
     10        ResourceHandleCFNet.cpp.
     11
     12        * platform/network/ResourceHandle.h:
     13        * platform/network/cf/ResourceHandleCFNet.cpp:
     14        (WebCore::canRespondToProtectionSpace):
     15        (WebCore::ResourceHandle::createCFURLConnection):
     16        (WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace):
     17        (WebCore::WebCoreSynchronousLoaderClient::canAuthenticateAgainstProtectionSpace):
     18        * platform/network/mac/ResourceHandleMac.mm:
     19        (-[WebCoreResourceHandleAsDelegate connection:canAuthenticateAgainstProtectionSpace:]): Add logging.
     20
    1212011-07-26  Sadrul Habib Chowdhury  <sadrul@chromium.org>
    222
  • trunk/Source/WebCore/platform/network/ResourceHandle.h

    r90873 r91799  
    123123#endif
    124124
    125 #if PLATFORM(MAC) && !USE(CFNETWORK)
    126     void didCancelAuthenticationChallenge(const AuthenticationChallenge&);
     125#if PLATFORM(MAC)
    127126#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
    128127    bool canAuthenticateAgainstProtectionSpace(const ProtectionSpace&);
    129128#endif
     129#if !USE(CFNETWORK)
     130    void didCancelAuthenticationChallenge(const AuthenticationChallenge&);
    130131    NSURLConnection *connection() const;
    131132    WebCoreResourceHandleAsDelegate *delegate();
     
    134135#endif
    135136
    136 #if PLATFORM(MAC)
    137137    void schedule(SchedulePair*);
    138138    void unschedule(SchedulePair*);
  • trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp

    r91200 r91799  
    104104    virtual void didFinishLoading(ResourceHandle*, double /*finishTime*/);
    105105    virtual void didFail(ResourceHandle*, const ResourceError&);
     106#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
     107    virtual bool canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace&);
     108#endif
    106109
    107110    bool m_allowStoredCredentials;
     
    348351    handle->didReceiveAuthenticationChallenge(AuthenticationChallenge(challenge, handle));
    349352}
     353
     354#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
     355static Boolean canRespondToProtectionSpace(CFURLConnectionRef conn, CFURLProtectionSpaceRef protectionSpace, const void* clientInfo)
     356{
     357#if LOG_DISABLED
     358    UNUSED_PARAM(conn);
     359#endif
     360    ResourceHandle* handle = static_cast<ResourceHandle*>(const_cast<void*>(clientInfo));
     361    ASSERT(handle);
     362
     363    LOG(Network, "CFNet - canRespondToProtectionSpace(conn=%p, handle=%p (%s)", conn, handle, handle->firstRequest().url().string().utf8().data());
     364
     365    return handle->canAuthenticateAgainstProtectionSpace(core(protectionSpace));
     366}
     367#endif
    350368
    351369ResourceHandleInternal::~ResourceHandleInternal()
     
    459477    RetainPtr<CFURLRequestRef> request(AdoptCF, makeFinalRequest(firstRequest(), shouldContentSniff));
    460478
    461 #if HAVE(CFNETWORK_DATA_ARRAY_CALLBACK)
    462     CFURLConnectionClient_V6 client = { 6, this, 0, 0, 0, WebCore::willSendRequest, didReceiveResponse, didReceiveData, 0, didFinishLoading, didFail, willCacheResponse, didReceiveChallenge, didSendBodyData, shouldUseCredentialStorageCallback, 0, 0, 0, didReceiveDataArray};
     479#if HAVE(CFNETWORK_DATA_ARRAY_CALLBACK) && USE(PROTECTION_SPACE_AUTH_CALLBACK)
     480    CFURLConnectionClient_V6 client = { 6, this, 0, 0, 0, WebCore::willSendRequest, didReceiveResponse, didReceiveData, 0, didFinishLoading, didFail, willCacheResponse, didReceiveChallenge, didSendBodyData, shouldUseCredentialStorageCallback, 0, canRespondToProtectionSpace, 0, didReceiveDataArray};
    463481#else
    464482    CFURLConnectionClient_V3 client = { 3, this, 0, 0, 0, WebCore::willSendRequest, didReceiveResponse, didReceiveData, 0, didFinishLoading, didFail, willCacheResponse, didReceiveChallenge, didSendBodyData, shouldUseCredentialStorageCallback, 0};
     
    597615}
    598616
     617#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
     618bool ResourceHandle::canAuthenticateAgainstProtectionSpace(const ProtectionSpace& protectionSpace)
     619{
     620    if (client())
     621        return client()->canAuthenticateAgainstProtectionSpace(this, protectionSpace);
     622
     623    return false;
     624}
     625#endif
     626
    599627void ResourceHandle::receivedCredential(const AuthenticationChallenge& challenge, const Credential& credential)
    600628{
     
    888916}
    889917
     918#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
     919bool WebCoreSynchronousLoaderClient::canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace&)
     920{
     921    // FIXME: We should ask FrameLoaderClient. <http://webkit.org/b/65196>
     922    return true;
     923}
     924#endif
     925
    890926#endif // USE(CFNETWORK)
    891927
  • trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm

    r90834 r91799  
    766766
    767767#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
    768 - (BOOL)connection:(NSURLConnection *)unusedConnection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace
    769 {
    770     UNUSED_PARAM(unusedConnection);
    771    
     768- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace
     769{
     770#if LOG_DISABLED
     771    UNUSED_PARAM(connection);
     772#endif
     773
     774    LOG(Network, "Handle %p delegate connection:%p canAuthenticateAgainstProtectionSpace:%p", m_handle, connection);
     775
    772776    if (!m_handle)
    773777        return NO;
    774        
     778
    775779    return m_handle->canAuthenticateAgainstProtectionSpace(core(protectionSpace));
    776780}
     
    952956bool WebCoreSynchronousLoaderClient::canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace&)
    953957{
    954     // FIXME: We should ask FrameLoaderClient.
     958    // FIXME: We should ask FrameLoaderClient. <http://webkit.org/b/65196>
    955959    return true;
    956960}
Note: See TracChangeset for help on using the changeset viewer.