Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 772671b

Browse files
Fix header sent after content, add padding to prevent default browser error pages
1 parent c9b7acc commit 772671b

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

‎deploy.php‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,20 @@ function removeLockFile() {
4545
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
4646
header("Cache-Control: post-check=0, pre-check=0", false);
4747
header("Pragma: no-cache");
48+
if (!isset($_GET['t']) || $_GET['t'] !== ACCESS_TOKEN) {
49+
header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403);
50+
removeLockFile();
51+
echo '<h2>Access Denied</h2>';
52+
echo '<!--' . str_repeat("", 512) . ' -->'; // prevent "friendly" browser error page
53+
die();
54+
}
55+
if (count($err) || ACCESS_TOKEN === '' || REMOTE_REPOSITORY === '' || BRANCH === '' || GIT_DIR === '' || TARGET_DIR === '') {
56+
header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403);
57+
removeLockFile();
58+
echo "<h2>Configuration Error</h2>\n<pre>\n" . implode("\n", $err) . "\n</pre>";
59+
echo '<!--' . str_repeat("", 512) . ' -->'; // prevent "friendly" browser error page
60+
die();
61+
}
4862
?>
4963
<!DOCTYPE html>
5064
<html lang="en">
@@ -61,18 +75,6 @@ function removeLockFile() {
6175
</style>
6276
</head>
6377
<body>
64-
<?php
65-
if (!isset($_GET['t']) || $_GET['t'] !== ACCESS_TOKEN) {
66-
header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403);
67-
removeLockFile();
68-
die('<h2>Access Denied</h2>');
69-
}
70-
if (count($err) || ACCESS_TOKEN === '' || REMOTE_REPOSITORY === '' || BRANCH === '' || GIT_DIR === '' || TARGET_DIR === '') {
71-
header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403);
72-
removeLockFile();
73-
die("<h2>Configuration Error</h2>\n<pre>\n" . implode("\n", $err) . "\n</pre>");
74-
}
75-
?>
7678
<pre>
7779
<?php
7880
// The branch

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /