root/LayoutTests/http/tests/multipart/resources/multipart.php

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. sendPart

<?php
    $boundary = "cutHere";

    function sendPart($data)
    {
        global $boundary;

        echo("Content-Type: image/png\r\n\r\n");
        echo($data);
        echo("--$boundary\r\n");
        flush();
    }

    $i = 1;
    while ($img = $_GET['img' . $i]) {
        $images[$i] = file_get_contents($img);
        $i++;
    }

    if (isset($_GET['interval']))
        $interval = $_GET['interval'] * 1000000;
    else
        $interval = 1000000;

    header("Content-Type: multipart/x-mixed-replace; boundary=$boundary");

    echo("--$boundary\r\n");

    ob_end_flush();
    do {
        for ($k = 1; $k < $i; $k++) {
            sendPart($images[$k]);
            usleep($interval);
        }
    } while ($_GET['loop']);

    if (isset($_GET['wait']))
        usleep($_GET['wait'] * 1000000);
?>

/* [<][>][^][v][top][bottom][index][help] */