Page MenuHomePhabricator

0001-Use-getallheaders-to-get-the-specific-http-header.patch

Authored By
enko
Nov 11 2013, 5:35 PM
Size
1 KB
Referenced Files
None
Subscribers
None

0001-Use-getallheaders-to-get-the-specific-http-header.patch

From c0693e6752c1d29c7de494adf3c7a9d7eb588858 Mon Sep 17 00:00:00 2001
From: Tim Schumacher <tim@bandenkrieg.hacked.jp>
Date: Mon, 11 Nov 2013 18:15:11 +0100
Subject: [PATCH] Use getallheaders to get the specific http-header.
---
src/aphront/AphrontRequest.php | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/aphront/AphrontRequest.php b/src/aphront/AphrontRequest.php
index d4d055f..aea7805 100644
--- a/src/aphront/AphrontRequest.php
+++ b/src/aphront/AphrontRequest.php
@@ -467,13 +467,13 @@ final class AphrontRequest {
public static function getHTTPHeader($name, $default = null) {
- // PHP mangles HTTP headers by uppercasing them and replacing hyphens with
- // underscores, then prepending 'HTTP_'.
- $php_index = strtoupper($name);
- $php_index = str_replace('-', '_', $php_index);
- $php_index = 'HTTP_'.$php_index;
+ $headers = getallheaders();
- return idx($_SERVER, $php_index, $default);
+ if (array_key_exists($name,$headers)) {
+ return $headers[$name];
+ } else {
+ return $default;
+ }
}
}
--
1.7.10.4

File Metadata

Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/dv/7b/ftf5kpim5ygs7ngc
Default Alt Text
0001-Use-getallheaders-to-get-the-specific-http-header.patch (1 KB)

Event Timeline