예제 #1
0
<?php

function addCacheControl()
{
    # Workaround for https://bugs.webkit.org/show_bug.cgi?id=77538
    # Caching redirects results in flakiness in tests that dump loader delegates.
    header("Cache-Control: no-store");
}
$url = $_GET['url'];
$refresh = $_GET['refresh'];
if (isset($refresh)) {
    header("HTTP/1.1 200");
    header("Refresh: {$refresh}; url={$url}");
    addCacheControl();
    return;
}
$code = $_GET['code'];
if (!isset($code)) {
    header("HTTP/1.1 302 Found");
} elseif ($code == 308) {
    # Apache 2.2 (and possibly some newer versions) cannot generate a reason string for code 308, and sends a 500 error instead.
    header("HTTP/1.1 308 Permanent Redirect");
} else {
    header("HTTP/1.1 {$code}");
}
header("Location: {$url}");
addCacheControl();
예제 #2
0
파일: redirect.php 프로젝트: eocanha/webkit
<?php

function addCacheControl($allowCache)
{
    if ($allowCache) {
        header("Cache-Control: public, max-age=86400");
    } else {
        # Workaround for https://bugs.webkit.org/show_bug.cgi?id=77538
        # Caching redirects results in flakiness in tests that dump loader delegates.
        header("Cache-Control: no-store");
    }
}
$url = $_GET['url'];
$allowCache = isset($_GET['allowCache']);
if (isset($_GET['refresh'])) {
    header("HTTP/1.1 200");
    header("Refresh: " . $_GET['refresh'] . "; url={$url}");
    addCacheControl($allowCache);
    return;
}
if (!isset($_GET['code'])) {
    header("HTTP/1.1 302 Found");
} elseif ($_GET['code'] == 308) {
    # Apache 2.2 (and possibly some newer versions) cannot generate a reason string for code 308, and sends a 500 error instead.
    header("HTTP/1.1 308 Permanent Redirect");
} else {
    header("HTTP/1.1 " . $_GET['code']);
}
header("Location: {$url}");
addCacheControl($allowCache);