https://bugs.webkit.org/show_bug.cgi?id=66354 and <rdar://problem/9965209>
Regression: On Lion, redirects lose HTTP authentication headers
Source/WebCore:
Reviewed by Alexey Proskuryakov and Darin Adler.
This changes makes WebCore try to apply basic credentials after a redirect if the redirect is to the same origin,
assuming the redirected URL did not contain credentials directly.
Tests: http/tests/misc/authentication-redirect-1/authentication-sent-to-redirect-cross-origin.html
http/tests/misc/authentication-redirect-2/authentication-sent-to-redirect-same-origin.html
http/tests/misc/authentication-redirect-3/authentication-sent-to-redirect-same-origin-with-location-credentials.html
* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::applyBasicAuthorizationHeader): Apply the user/password from a credential to the HTTP headers for a request.
(WebCore::ResourceHandle::createCFURLConnection): Use the applyBasicAuthorizationHeader helper.
(WebCore::ResourceHandle::willSendRequest): If this is a redirect within the same origin, apply any stored target credentials to the new request.
* platform/network/mac/ResourceHandleMac.mm:
(WebCore::applyBasicAuthorizationHeader): Apply the user/password from a credential to the HTTP headers for a request.
(WebCore::ResourceHandle::createNSURLConnection): Use the applyBasicAuthorizationHeader helper.
(WebCore::ResourceHandle::willSendRequest): If this is a redirect within the same origin, apply any stored target credentials to the new request.
LayoutTests:
These have to be in different paths to prevent credentials from leaking over from test to test.
Sad sad sad...
Reviewed by Alexey Proskuryakov.
* http/tests/misc/authentication-redirect-1: Added.
* http/tests/misc/authentication-redirect-1/authentication-sent-to-redirect-cross-origin-expected.txt: Copied from LayoutTests/http/tests/misc/authentication-sent-to-redirect-expected.txt.
* http/tests/misc/authentication-redirect-1/authentication-sent-to-redirect-cross-origin.html: Copied from LayoutTests/http/tests/misc/authentication-sent-to-redirect.html.
* http/tests/misc/authentication-redirect-1/resources: Added.
* http/tests/misc/authentication-redirect-1/resources/auth-echo.php: Copied from LayoutTests/http/tests/misc/resources/auth-echo.php.
* http/tests/misc/authentication-redirect-1/resources/auth-then-redirect.php: Copied from LayoutTests/http/tests/misc/resources/auth-then-redirect.php.
* http/tests/misc/authentication-redirect-2: Added.
* http/tests/misc/authentication-redirect-2/authentication-sent-to-redirect-same-origin-expected.txt: Added.
* http/tests/misc/authentication-redirect-2/authentication-sent-to-redirect-same-origin.html: Added.
* http/tests/misc/authentication-redirect-2/resources: Added.
* http/tests/misc/authentication-redirect-2/resources/auth-echo.php: Copied from LayoutTests/http/tests/misc/resources/auth-echo.php.
* http/tests/misc/authentication-redirect-2/resources/auth-then-redirect.php: Copied from LayoutTests/http/tests/misc/resources/auth-then-redirect.php.
* http/tests/misc/authentication-redirect-3: Added.
* http/tests/misc/authentication-redirect-3/authentication-sent-to-redirect-same-origin-with-location-credentials-expected.txt: Added.
* http/tests/misc/authentication-redirect-3/authentication-sent-to-redirect-same-origin-with-location-credentials.html: Added.
* http/tests/misc/authentication-redirect-3/resources: Added.
* http/tests/misc/authentication-redirect-3/resources/auth-echo.php: Copied from LayoutTests/http/tests/misc/resources/auth-echo.php.
* http/tests/misc/authentication-redirect-3/resources/auth-then-redirect-with-url-credentials.php: Added.
* http/tests/misc/authentication-redirect-3/resources/auth-then-redirect.php: Copied from LayoutTests/http/tests/misc/resources/auth-then-redirect.php.
* http/tests/misc/authentication-sent-to-redirect-expected.txt: Removed.
* http/tests/misc/authentication-sent-to-redirect.html: Removed.
* http/tests/misc/resources/auth-echo.php: Removed.
* http/tests/misc/resources/auth-then-redirect.php: Removed.
git-svn-id: svn://svn.chromium.org/blink/trunk@93247 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Showing
File moved
Please register or sign in to comment