Changeset 106307 in webkit


Ignore:
Timestamp:
Jan 30, 2012 5:25:08 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

BlackBerry - Support Proxy-Authenticate headers when a proxy is configured
https://bugs.webkit.org/show_bug.cgi?id=77361

Though we have a proxy configured, we might not have the auth
credentials it requires. Support Proxy-Authenticate for that case.

Patch by Christopher Hutten-Czapski <chutten@rim.com> on 2012-01-30
Reviewed by George Staikos.

  • platform/network/blackberry/NetworkJob.cpp:

(WebCore::NetworkJob::handleNotifyHeaderReceived):
(WebCore::NetworkJob::handleAuthHeader):
(WebCore::NetworkJob::sendRequestWithCredentials):

  • platform/network/blackberry/NetworkJob.h:
  • platform/network/blackberry/NetworkManager.cpp:

(WebCore::NetworkManager::startJob):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r106306 r106307  
     12012-01-30  Christopher Hutten-Czapski  <chutten@rim.com>
     2
     3        BlackBerry - Support Proxy-Authenticate headers when a proxy is configured
     4        https://bugs.webkit.org/show_bug.cgi?id=77361
     5
     6        Though we have a proxy configured, we might not have the auth
     7        credentials it requires. Support Proxy-Authenticate for that case.
     8
     9        Reviewed by George Staikos.
     10
     11        * platform/network/blackberry/NetworkJob.cpp:
     12        (WebCore::NetworkJob::handleNotifyHeaderReceived):
     13        (WebCore::NetworkJob::handleAuthHeader):
     14        (WebCore::NetworkJob::sendRequestWithCredentials):
     15        * platform/network/blackberry/NetworkJob.h:
     16        * platform/network/blackberry/NetworkManager.cpp:
     17        (WebCore::NetworkManager::startJob):
     18
    1192012-01-27  James Robinson  <jamesr@chromium.org>
    220
  • trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp

    r104013 r106307  
    317317
    318318    if (lowerKey == "www-authenticate")
    319         handleAuthHeader(value);
     319        handleAuthHeader(ProtectionSpaceServerHTTP, value);
     320    else if (lowerKey == "proxy-authenticate" && !BlackBerry::Platform::Client::get()->getProxyAddress().empty())
     321        handleAuthHeader(ProtectionSpaceProxyHTTP, value);
    320322
    321323    if (equalIgnoringCase(key, BlackBerry::Platform::NetworkRequest::HEADER_BLACKBERRY_FTP))
     
    702704}
    703705
    704 bool NetworkJob::handleAuthHeader(const String& header)
     706bool NetworkJob::handleAuthHeader(const ProtectionSpaceServerType space, const String& header)
    705707{
    706708    if (!m_handle)
     
    714716
    715717    if (equalIgnoringCase(header, "ntlm"))
    716         sendRequestWithCredentials(ProtectionSpaceServerHTTP, ProtectionSpaceAuthenticationSchemeNTLM, "NTLM");
     718        sendRequestWithCredentials(space, ProtectionSpaceAuthenticationSchemeNTLM, "NTLM");
    717719
    718720    // Extract the auth scheme and realm from the header.
    719721    size_t spacePos = header.find(' ');
    720722    if (spacePos == notFound) {
    721         LOG(Network, "WWW-Authenticate field '%s' badly formatted: missing scheme.", header.utf8().data());
     723        LOG(Network, "%s-Authenticate field '%s' badly formatted: missing scheme.", space == ProtectionSpaceServerHTTP ? "WWW" : "Proxy", header.utf8().data());
    722724        return false;
    723725    }
     
    737739    size_t realmPos = header.findIgnoringCase("realm=", spacePos);
    738740    if (realmPos == notFound) {
    739         LOG(Network, "WWW-Authenticate field '%s' badly formatted: missing realm.", header.utf8().data());
     741        LOG(Network, "%s-Authenticate field '%s' badly formatted: missing realm.", space == ProtectionSpaceServerHTTP ? "WWW" : "Proxy", header.utf8().data());
    740742        return false;
    741743    }
     
    746748        size_t endPos = header.find("\"", beginPos);
    747749        if (endPos == notFound) {
    748             LOG(Network, "WWW-Authenticate field '%s' badly formatted: invalid realm.", header.utf8().data());
     750            LOG(Network, "%s-Authenticate field '%s' badly formatted: invalid realm.", space == ProtectionSpaceServerHTTP ? "WWW" : "Proxy", header.utf8().data());
    749751            return false;
    750752        }
     
    753755
    754756    // Get the user's credentials and resend the request.
    755     sendRequestWithCredentials(ProtectionSpaceServerHTTP, protectionSpaceScheme, realm);
     757    sendRequestWithCredentials(space, protectionSpaceScheme, realm);
    756758
    757759    return true;
     
    797799        return false;
    798800
    799     ProtectionSpace protectionSpace(m_response.url().host(), m_response.url().port(), type, realm, scheme);
     801    int port = 0;
     802    if (type == ProtectionSpaceProxyHTTP) {
     803        std::stringstream toPort(BlackBerry::Platform::Client::get()->getProxyPort());
     804        toPort >> port;
     805    } else
     806        port = m_response.url().port();
     807
     808    ProtectionSpace protectionSpace((type == ProtectionSpaceProxyHTTP) ? BlackBerry::Platform::Client::get()->getProxyAddress().c_str() : m_response.url().host()
     809            , port, type, realm, scheme);
    800810
    801811    // We've got the scheme and realm. Now we need a username and password.
  • trunk/Source/WebCore/platform/network/blackberry/NetworkJob.h

    r103487 r106307  
    130130    // The server needs authentication credentials. Search in the
    131131    // CredentialStorage or prompt the user via dialog.
    132     bool handleAuthHeader(const String& header);
     132    bool handleAuthHeader(const ProtectionSpaceServerType, const String& header);
    133133
    134134    bool handleFTPHeader(const String& header);
  • trunk/Source/WebCore/platform/network/blackberry/NetworkManager.cpp

    r102433 r106307  
    105105        } else if (type == ProtectionSpaceServerFTP)
    106106            authType = BlackBerry::Platform::NetworkRequest::AuthFTP;
     107        else if (type == ProtectionSpaceProxyHTTP)
     108            authType = BlackBerry::Platform::NetworkRequest::AuthProxy;
    107109
    108110        if (authType != BlackBerry::Platform::NetworkRequest::AuthNone)
Note: See TracChangeset for help on using the changeset viewer.