Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / loading / resources / test2 / basic-auth-testing.php
blob2ecd61228cd9eaada7b46de02be21d8b86fb56df
1 <?php
2 $expectedUsername = isset($_GET['username']) ? $_GET['username'] : 'username';
3 $expectedPassword = isset($_GET['password']) ? $_GET['password'] : 'password';
4 $realm = isset($_GET['realm']) ? $_GET['realm'] : $_SERVER['REQUEST_URI'];
6 header("Cache-Control: no-store");
7 if (!isset($_SERVER['PHP_AUTH_USER']) || $_SERVER['PHP_AUTH_USER'] != $expectedUsername ||
8 !isset($_SERVER['PHP_AUTH_PW']) || $_SERVER['PHP_AUTH_PW'] != $expectedPassword) {
9 header("WWW-Authenticate: Basic realm=\"" . $realm . "\"");
10 header('HTTP/1.0 401 Unauthorized');
11 print 'Sent username:password of (' . $_SERVER['PHP_AUTH_USER'] . ':' . $_SERVER['PHP_AUTH_PW'] . ') which is not what was expected';
12 exit;
15 Authenticated as user: <?php print (string)$_SERVER['PHP_AUTH_USER']?> password: <?php print (string)$_SERVER['PHP_AUTH_PW']?>