Make WordPress Core


Ignore:
Timestamp:
07/28/2013 08:13:11 AM (12 years ago)
Author:
dd32
Message:

HTTP-External tests: Add a copy of the updates unit test API script used for r1317 and r1316

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/data/WPHTTP-testcase-redirection-script.php

    r1231 r1318  
    2424    exit;
    2525}
     26
    2627if ( isset($_GET['201-location']) ) {
    2728    header("HTTP/1.1 201 OK");
     
    5253}
    5354
     55if ( isset( $_GET['post-redirect-to-method'] ) ) {
     56    $method = $_SERVER['REQUEST_METHOD'];
     57    $response_code = isset( $_GET['response_code'] ) ? $_GET['response_code'] : 301;
     58
     59    if ( 'POST' == $method && ! isset( $_GET['redirection-performed'] ) ) {
     60        header( "Location: $url?post-redirect-to-method=1&redirection-performed=1", true, $response_code );
     61        exit;
     62    }
     63
     64    echo $method;
     65    exit;
     66   
     67}
     68
     69if ( isset( $_GET['location-with-200'] ) ) {
     70    if ( ! isset( $_GET['redirection-performed'] ) ) {
     71        header( "HTTP/1.1 200 OK" );
     72        header( "Location: $url?location-with-200=1&redirection-performed", true, 200 );
     73        echo 'PASS';
     74        exit;
     75    }
     76    // Redirection was followed
     77    echo 'FAIL';
     78    exit;
     79}
     80
     81if ( isset( $_GET['print-pass'] ) ) {
     82    echo 'PASS';
     83    exit;
     84}
     85
    5486$rt = isset($_GET['rt']) ? $_GET['rt'] : 5;
    5587$r = isset($_GET['r']) ? $_GET['r'] : 0;
    56 
    57 /*if ( $r === 0 ) {
    58     header("Location: http://tools.dd32.id.au/redirect/?r=1" );
    59     exit;
    60 }*/
    6188
    6289if ( $r < $rt ) {
     
    7097echo "GET['r'] = Current redirection. Defaults to 0.<br />";
    7198echo "<a href='$url?source=true'>View Source</a>";
     99
Note: See TracChangeset for help on using the changeset viewer.