Skip to content

Commit ea2684d

Browse files
committed
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.
1 parent 9375cfc commit ea2684d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
header('HTTP/1.0 404 Not Found');
8787
echo "404 - Not found";
8888
} else {
89-
list($header, $body) = explode("\r\n\r\n", $response);
89+
list($header, $body) = explode("\r\n\r\n", $response, 2);
9090
$headers = explode("\n",$header);
9191
foreach($headers as $h){
9292
header($h);

0 commit comments

Comments
 (0)