Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- Bug #70470 (Built-in server truncates headers spanning over TCP packets) --SKIPIF..

Decoded Output download

--TEST--
Bug #70470 (Built-in server truncates headers spanning over TCP packets)
--SKIPIF--
<?php
include "skipif.inc";
?>
--FILE--
<?php
include "php_cli_server.inc";
php_cli_server_start("var_dump(getAllheaders());");

$fp = php_cli_server_connect();

fwrite($fp, "GET / HTTP/1.1
");
fwrite($fp, "Host: " . PHP_CLI_SERVER_HOSTNAME . "
");
fwrite($fp, "Content");
fflush($fp);
usleep(200000);
fwrite($fp, "-Type: text/html; charset=UTF-8
");
fwrite($fp, "Connection: clo");
fflush($fp);
usleep(200000);
fwrite($fp, "se

");
while (!feof($fp)) {
    echo fgets($fp);
}
fclose($fp);
?>
--EXPECTF--
HTTP/1.1 200 OK
%a
array(3) {
  ["Host"]=>
  string(9) "localhost"
  ["Content-Type"]=>
  string(24) "text/html; charset=UTF-8"
  ["Connection"]=>
  string(5) "close"
}

Did this file decode correctly?

Original Code

--TEST--
Bug #70470 (Built-in server truncates headers spanning over TCP packets)
--SKIPIF--
<?php
include "skipif.inc";
?>
--FILE--
<?php
include "php_cli_server.inc";
php_cli_server_start("var_dump(getAllheaders());");

$fp = php_cli_server_connect();

fwrite($fp, "GET / HTTP/1.1\r\n");
fwrite($fp, "Host: " . PHP_CLI_SERVER_HOSTNAME . "\r\n");
fwrite($fp, "Content");
fflush($fp);
usleep(200000);
fwrite($fp, "-Type: text/html; charset=UTF-8\r\n");
fwrite($fp, "Connection: clo");
fflush($fp);
usleep(200000);
fwrite($fp, "se\r\n\r\n");
while (!feof($fp)) {
    echo fgets($fp);
}
fclose($fp);
?>
--EXPECTF--
HTTP/1.1 200 OK
%a
array(3) {
  ["Host"]=>
  string(9) "localhost"
  ["Content-Type"]=>
  string(24) "text/html; charset=UTF-8"
  ["Connection"]=>
  string(5) "close"
}

Function Calls

None

Variables

None

Stats

MD5 db257bca16f5e725c4609502e96a58da
Eval Count 0
Decode Time 386 ms