Skip to content
Permalink
Browse files

Fixed bug where white space caused incorrect header and body

White space is being used to decide which part of $response is to be in the HTTP header and body. However, if there was any further line breaks in the page being served, these caused anything else in the body to be ignored: in my case, there was a line break before the <body> tag, so only the <head>...</head> part of the HTML was served and a blank page was the result. I added a limit of 2 to explode() in order to make sure that ALL the remainder of the response would be in the body. This fixed the problem immediately.
  • Loading branch information...
talat77 committed Aug 2, 2013
1 parent 9375cfc commit ea2684df2a293c2dee6810bbbd24aa03342e3d4b
Showing with 1 addition and 1 deletion.
  1. +1 −1 index.php
@@ -86,7 +86,7 @@
header('HTTP/1.0 404 Not Found');
echo "404 - Not found";
} else {
list($header, $body) = explode("\r\n\r\n", $response);
list($header, $body) = explode("\r\n\r\n", $response, 2);
$headers = explode("\n",$header);
foreach($headers as $h){
header($h);

0 comments on commit ea2684d

Please sign in to comment.
You can’t perform that action at this time.