Modified: trunk/Source/WebCore/ChangeLog (106306 => 106307)
--- trunk/Source/WebCore/ChangeLog 2012-01-31 01:23:11 UTC (rev 106306)
+++ trunk/Source/WebCore/ChangeLog 2012-01-31 01:25:08 UTC (rev 106307)
@@ -1,3 +1,21 @@
+2012-01-30 Christopher Hutten-Czapski <[email protected]>
+
+ 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.
+
+ 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):
+
2012-01-27 James Robinson <[email protected]>
[chromium] Remove unnecessary retry logic in LayerRendererChromium initialization for accelerated painting
Modified: trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp (106306 => 106307)
--- trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp 2012-01-31 01:23:11 UTC (rev 106306)
+++ trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp 2012-01-31 01:25:08 UTC (rev 106307)
@@ -316,7 +316,9 @@
}
if (lowerKey == "www-authenticate")
- handleAuthHeader(value);
+ handleAuthHeader(ProtectionSpaceServerHTTP, value);
+ else if (lowerKey == "proxy-authenticate" && !BlackBerry::Platform::Client::get()->getProxyAddress().empty())
+ handleAuthHeader(ProtectionSpaceProxyHTTP, value);
if (equalIgnoringCase(key, BlackBerry::Platform::NetworkRequest::HEADER_BLACKBERRY_FTP))
handleFTPHeader(value);
@@ -701,7 +703,7 @@
notifyClose(BlackBerry::Platform::FilterStream::StatusSuccess);
}
-bool NetworkJob::handleAuthHeader(const String& header)
+bool NetworkJob::handleAuthHeader(const ProtectionSpaceServerType space, const String& header)
{
if (!m_handle)
return false;
@@ -713,12 +715,12 @@
return false;
if (equalIgnoringCase(header, "ntlm"))
- sendRequestWithCredentials(ProtectionSpaceServerHTTP, ProtectionSpaceAuthenticationSchemeNTLM, "NTLM");
+ sendRequestWithCredentials(space, ProtectionSpaceAuthenticationSchemeNTLM, "NTLM");
// Extract the auth scheme and realm from the header.
size_t spacePos = header.find(' ');
if (spacePos == notFound) {
- LOG(Network, "WWW-Authenticate field '%s' badly formatted: missing scheme.", header.utf8().data());
+ LOG(Network, "%s-Authenticate field '%s' badly formatted: missing scheme.", space == ProtectionSpaceServerHTTP ? "WWW" : "Proxy", header.utf8().data());
return false;
}
@@ -736,7 +738,7 @@
size_t realmPos = header.findIgnoringCase("realm=", spacePos);
if (realmPos == notFound) {
- LOG(Network, "WWW-Authenticate field '%s' badly formatted: missing realm.", header.utf8().data());
+ LOG(Network, "%s-Authenticate field '%s' badly formatted: missing realm.", space == ProtectionSpaceServerHTTP ? "WWW" : "Proxy", header.utf8().data());
return false;
}
size_t beginPos = realmPos + 6;
@@ -745,14 +747,14 @@
beginPos += 1;
size_t endPos = header.find("\"", beginPos);
if (endPos == notFound) {
- LOG(Network, "WWW-Authenticate field '%s' badly formatted: invalid realm.", header.utf8().data());
+ LOG(Network, "%s-Authenticate field '%s' badly formatted: invalid realm.", space == ProtectionSpaceServerHTTP ? "WWW" : "Proxy", header.utf8().data());
return false;
}
realm = header.substring(beginPos, endPos - beginPos);
}
// Get the user's credentials and resend the request.
- sendRequestWithCredentials(ProtectionSpaceServerHTTP, protectionSpaceScheme, realm);
+ sendRequestWithCredentials(space, protectionSpaceScheme, realm);
return true;
}
@@ -796,8 +798,16 @@
if (!newURL.isValid())
return false;
- ProtectionSpace protectionSpace(m_response.url().host(), m_response.url().port(), type, realm, scheme);
+ int port = 0;
+ if (type == ProtectionSpaceProxyHTTP) {
+ std::stringstream toPort(BlackBerry::Platform::Client::get()->getProxyPort());
+ toPort >> port;
+ } else
+ port = m_response.url().port();
+ ProtectionSpace protectionSpace((type == ProtectionSpaceProxyHTTP) ? BlackBerry::Platform::Client::get()->getProxyAddress().c_str() : m_response.url().host()
+ , port, type, realm, scheme);
+
// We've got the scheme and realm. Now we need a username and password.
// First search the CredentialStorage.
Credential credential = CredentialStorage::get(protectionSpace);
Modified: trunk/Source/WebCore/platform/network/blackberry/NetworkJob.h (106306 => 106307)
--- trunk/Source/WebCore/platform/network/blackberry/NetworkJob.h 2012-01-31 01:23:11 UTC (rev 106306)
+++ trunk/Source/WebCore/platform/network/blackberry/NetworkJob.h 2012-01-31 01:25:08 UTC (rev 106307)
@@ -129,7 +129,7 @@
// The server needs authentication credentials. Search in the
// CredentialStorage or prompt the user via dialog.
- bool handleAuthHeader(const String& header);
+ bool handleAuthHeader(const ProtectionSpaceServerType, const String& header);
bool handleFTPHeader(const String& header);
Modified: trunk/Source/WebCore/platform/network/blackberry/NetworkManager.cpp (106306 => 106307)
--- trunk/Source/WebCore/platform/network/blackberry/NetworkManager.cpp 2012-01-31 01:23:11 UTC (rev 106306)
+++ trunk/Source/WebCore/platform/network/blackberry/NetworkManager.cpp 2012-01-31 01:25:08 UTC (rev 106307)
@@ -104,6 +104,8 @@
}
} else if (type == ProtectionSpaceServerFTP)
authType = BlackBerry::Platform::NetworkRequest::AuthFTP;
+ else if (type == ProtectionSpaceProxyHTTP)
+ authType = BlackBerry::Platform::NetworkRequest::AuthProxy;
if (authType != BlackBerry::Platform::NetworkRequest::AuthNone)
platformRequest.setCredentials(username.utf8().data(), password.utf8().data(), authType);