Replace the --base code with relative paths.
[darkstat] / contrib / darkproxy.php
1 <?php
2 # copyright (c) 2011 Malte S. Stretz
3 #
4 # This is a simple proxy script to test the proper implementation of
5 # relative hrefs in combination with eg. lighttpd 1.4 which doesn't
6 # support the features of mod_proxy_core yet.
7
8 $darkstat = "http://localhost:667";
9
10 if ($_SERVER['PATH_INFO'] == '') {
11 header("Status: 303 Move!", true);
12 header("Location: " . $_SERVER['PHP_SELF'] . "/", true);
13 exit;
14 }
15
16 function header_cb($proxy, $h) {
17 header($h);
18 return strlen($h);
19 }
20
21 $proxy = curl_init();
22 curl_setopt($proxy, CURLOPT_URL, $darkstat . $_SERVER['PATH_INFO']);
23 curl_setopt($proxy, CURLOPT_HEADERFUNCTION, 'header_cb');
24 curl_exec($proxy);
25 curl_close($proxy);