Bug #65943 [Opn->Csd]: Blank headers missing with apache_request_headers
| From: | jgotts at gmail dot com | Date: | Tue, 22 Oct 2013 22:37:37 +0000 |
| Subject: | Bug #65943 [Opn->Csd]: Blank headers missing with apache_request_headers | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-182394@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65943&edit=1
ID: 65943
User updated by: jgotts at gmail dot com
Reported by: jgotts at gmail dot com
Summary: Blank headers missing with apache_request_headers
-Status: Open
+Status: Closed
Type: Bug
Package: Apache related
Operating System: Linux
PHP Version: 5.4.21
Block user comment: N
Private report: N
New Comment:
I'm going to close this bug because it's a bug in XMLHttpRequest::setRequestHeader() in
Firefox 24, not in PHP.
PHP does the right thing when I explicitly set a blank header like this:
curl -k -H "my-header;" https://127.0.0.1/test.php
test.php:
<?php
print_r(apache_request_headers());
?>
Output:
Array
(
[User-Agent] => curl/7.27.0
[Host] => 127.0.0.1
[Accept] => */*
[my-header] =>
)
Previous Comments:
------------------------------------------------------------------------
[2013-10-22 01:48:25] jgotts at gmail dot com
Description:
------------
It appears that apache_request_headers won't return blank headers. The key for said header is
missing from the associative array. We have something quite simple on the JavaScript side:
var xhr = new XMLHttpRequest();
...
xhr.setRequestHeader('my-header', '');
Nothing in https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest
disallows a blank second argument for setRequestHeader().
And on the PHP side, we have:
$headers = apache_request_headers();
$headers['my-header'] is missing! What ate it?
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65943&edit=1