Skip to content

Instantly share code, notes, and snippets.

@wkoszek
Created December 18, 2015 21:46
Show Gist options
  • Save wkoszek/fd7d244187d361c52fe8 to your computer and use it in GitHub Desktop.
Save wkoszek/fd7d244187d361c52fe8 to your computer and use it in GitHub Desktop.
<?php
$beuwulf = "zxcv1234bnm,1234asdf1234ghjk1234qwer1234rtyu1234uiop1234";
header("Content-Type: text/plain; charset=UTF-8");
header_remove("Content-Length");
header("Transfer-Encoding: chunked");
ob_start();
// Spit out initial content length
echo sprintf("%x\r\n", strlen($beuwulf));
flush();
ob_flush();
// Spit out content
echo $beuwulf;
echo "\r\n";
flush();
ob_flush();
// Spit out termination
echo sprintf("0\r\n\r\n");
flush();
ob_flush();
?>
@wkoszek
Copy link
Author

wkoszek commented Dec 18, 2015

Added an output from:

(
   echo "GET /<script> HTTP/1.1"
   echo "Host: <host>"
) | nc <host> 80

Output:

========= Apache ===========
HTTP/1.1 200 OK
Date: Fri, 18 Dec 2015 21:54:45 GMT
Server: Apache/2.2.29 (Amazon)
X-Powered-By: PHP/5.3.29
Transfer-Encoding: chunked
Access-Control-Allow-Origin: *
Connection: close
Content-Type: text/plain; charset=UTF-8

38
zxcv1234bnm,1234asdf1234ghjk1234qwer1234rtyu1234uiop1234
0

========= Nginx ===========
HTTP/1.1 200 OK
Server: nginx/1.9.9
Date: Fri, 18 Dec 2015 21:55:09 GMT
Content-Type: text/plain; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.5.9-1ubuntu4.14

43
38
zxcv1234bnm,1234asdf1234ghjk1234qwer1234rtyu1234uiop1234
0


0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment