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 322d44a

Browse files
Merge pull request #9 from SagePtr/fix-headers
Fix getallheaders function polyfill to respect proper X-GitHub-* headers casing
2 parents 9e6e775 + 81dc45b commit 322d44a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

‎deploy.php‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,18 @@ function endScript($msg = "",$display = false) {
205205
if (!function_exists('getallheaders')) {
206206
function getallheaders() {
207207
$headers = [];
208+
if (isset($_SERVER['CONTENT_TYPE']))
209+
$headers['Content-Type'] = $_SERVER['CONTENT_TYPE'];
210+
if (isset($_SERVER['CONTENT_LENGTH']))
211+
$headers['Content-Length'] = $_SERVER['CONTENT_LENGTH'];
208212
foreach ($_SERVER as $name => $value) {
209213
if (substr($name, 0, 5) == 'HTTP_') {
210-
$headers[str_replace('', '-', ucwords(strtolower(str_replace('_', '', substr($name, 5)))))] = $value;
214+
$name = substr($name, 5);
215+
$name = str_replace('_', '', $name);
216+
$name = ucwords(strtolower($name));
217+
$name = str_replace('', '-', $name);
218+
$name = str_replace('X-Github', 'X-GitHub', $name);
219+
$headers[$name] = $value;
211220
}
212221
}
213222
return $headers;

0 commit comments

Comments
(0)

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