php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45794 HTTP headers rendered differently in PHP than Apache rewrite mod likes them
Submitted: 2008-08-12 06:08 UTC Modified: 2008-08-13 03:21 UTC
From: tarag956 at gmail dot com Assigned:
Status: Not a bug Package: *Web Server problem
PHP Version: 5.2.6 OS: nix
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: tarag956 at gmail dot com
New email:
PHP Version: OS:

 

 [2008-08-12 06:08 UTC] tarag956 at gmail dot com
Description:
------------
HTTP headers rendered differently in PHP than Apache rewrite mod likes them

For instance...

PHP renders a header this way (from the $_SERVER associated array):
HTTP_X_MOZ


But apache rewrite mod likes it:
HTTP:X-MOZ

I couldn't find any previous reports on this.  But basically, PHP needs some way for its HTTP headers to end up looking the same way that Apache's mod-rewrite likes them.



Other examples...
Apache likes them like:
HTTP:X-FORWARDED-FOR
REMOTE_ADDR
HTTP:CLIENT-IP
REQUEST_METHOD

But PHP usually converts all "-" to "_" and converts all ":" to "_" and sometimes adds "HTTP_" in front of things.

Maybe this is a feature request, but it would be nice if PHP's HTTP header variables could go be the exact names that HTTP's rewrite mod like them as.

Reproduce code:
---------------
..

Expected result:
----------------
..

Actual result:
--------------
..

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-12 13:32 UTC] lbarnaud@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

HTTP headers and other variables follows the CGI specification:
http://hoohoo.ncsa.uiuc.edu/cgi/env.html

 [2008-08-12 15:17 UTC] tarag956 at gmail dot com
Those links you gave were worthless and unrelated to the issue.

I've already read through the manual fully.

Are you claiming that somewhere hidden PHP actually can get the same exact style of headers ad mod-rewrite?  I have checked fully and there is no such thing.

Or are you claiming this is something PHP knows about and "won't fix"?

You never explicitly stated your reason for decaring the bug "bogus".
 [2008-08-12 15:20 UTC] tarag956 at gmail dot com
Also your first paragraph was an obvious form letter, and your second paragraph was unrelated so I'm no even sure if you understood what I initially said.

Also as for flagging bugs bogus, here's a screenshot unrelated to this bug report but related to falsely flagging bugs a bogus:
http://images.encyclopediadramatica.com/images/c/c9/Why_PHP_remains_slow.png
 [2008-08-12 15:21 UTC] tarag956 at gmail dot com
The form cut off the URL of the screenshot then made a link out of the decapitated URL.  It needs to be all on one line to be viewed.
 [2008-08-12 16:17 UTC] lbarnaud@php.net
> Or are you claiming this is something PHP knows about and "won't
fix"?

Yes, this is known and expected. The X-Moz header or any header can be
retrieved by making it upper case and by replacing "-" by "_".

The advantage is that it allows only one representation of an header
(X-Moz, X-MOZ or x-moz will all be available with HTTP_X_MOZ).
 [2008-08-13 03:21 UTC] tarag956 at gmail dot com
So can you reclassify it as a feature request to view the actual raw headers how they were written that the browser sends in PHP?
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Sep 24 01:03:38 2021 UTC