summaryrefslogtreecommitdiff
path: root/tests/it_url.testserver.php
blob: 2d10052800157cf478db49e5be8b70ce38c58f64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
require '/www/server/phpinclude/auto_prepend.php';
$stderr = fopen('php://stderr', 'w');
fwrite($stderr, "Got Request: '" . $_SERVER['REQUEST_URI'] . "'\n");

switch ($_SERVER['PHP_SELF'])
{
	case "/":
		echo 'Testserver root output';
		break;
	
	case "/temp_redirect":
		it_url::redirect(U("redirect_target", array('type' => 'temporary')), 'temporary');
		break;

	case "/perm_redirect":
		it_url::redirect(U("redirect_target", array('type' => 'permanent')), 'permanent');
		break;

	case "/redirect_loop":
		if ($_REQUEST['num'] > 0)
			it_url::redirect(U("redirect_loop", array('num' => $_REQUEST['num'] - 1)));
		break;

	case "/nohost_redirect":
		header('Location: /redirect_target?type=nohost', true, 301);
		exit;

	case "/relative_redirect":
		header('Location: ../redirect_target?type=relative', true, 301);
		exit;

	case "/redirect_target":
		echo 'Testserver output after ' . $_REQUEST['type'] . ' redirect';
		break;

	default:
		fwrite($stderr, "Unknown path '$_SERVER[PHP_SELF]' not handled!\n");
}