Skip to content

Commit

Permalink
Fixed bug where white space caused incorrect header and body
Browse files Browse the repository at this point in the history
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
hawddamor committed Aug 2, 2013
1 parent 9375cfc commit ea2684d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.php
Expand Up @@ -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);
Expand Down

0 comments on commit ea2684d

Please sign in to comment.