Debian Bug report logs - #795572
getallheaders for php-fpm patch ignores Content-Type and Content-Length headers

version graph

Package: php5-fpm; Maintainer for php5-fpm is (unknown);

Reported by: Gaudenz Steinlin <gaudenz@debian.org>

Date: Sat, 15 Aug 2015 10:33:02 UTC

Severity: normal

Found in version php5/5.6.9+dfsg-0+deb8u1

Fixed in version 5.6.26+dfsg-1+rm

Done: Debian FTP Masters <ftpmaster@ftp-master.debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>:
Bug#795572; Package php5-fpm. (Sat, 15 Aug 2015 10:33:06 GMT) (full text, mbox, link).


Acknowledgement sent to Gaudenz Steinlin <gaudenz@debian.org>:
New Bug report received and forwarded. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>. (Sat, 15 Aug 2015 10:33:06 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Gaudenz Steinlin <gaudenz@debian.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: getallheaders for php-fpm patch ignores Content-Type and Content-Length headers
Date: Sat, 15 Aug 2015 12:28:40 +0200
Package: php5-fpm
Version: 5.6.9+dfsg-0+deb8u1
Severity: normal

The php5 package in Debian carries a patch to add the getallheaders
function to FastCGI (fpm) build. This function is not supported for this
build upstream at all. See
debian/patches/0046-getallheaders-for-php-fpm-62596.patch

This patch works for "normal" headers which are translated to HTTP_XXX
environment variables by PHP, but it does not work for the Content-Type
and Content-Length headers. There is code in the patch that is supposed
to cover this case, but it does not work. The two headers are missing
from the array returned by getallheaders.

Here is sample code to demonstrate the issue.

# cat getallheaders.php
<?php 

var_dump(getallheaders());

var_dump($_SERVER);

?>

$ POST -U -H "X-DUMMY: my test header" -c text/xml http://myserver/getallheaders.php
Please enter content (text/xml) to be POSTed:
adsflkj öalksjdf ölkjasdf
POST https://ubol.ch/getallheaders.php
User-Agent: lwp-request/6.09 libwww-perl/6.13
Content-Length: 28
Content-Type: text/xml
X-DUMMY: my test header

array(5) {
  ["Te"]=>
  string(18) "deflate,gzip;q=0.3"
  ["Connection"]=>
  string(9) "TE, close"
  ["Host"]=>
  string(7) "myserver"
  ["User-Agent"]=>
  string(33) "lwp-request/6.09 libwww-perl/6.13"
  ["X-Dummy"]=>
  string(14) "my test header"
}
array(37) {
[...]
  ["FCGI_ROLE"]=>
  string(9) "RESPONDER"
  ["SCRIPT_URL"]=>
  string(18) "/getallheaders.php"
  ["SCRIPT_URI"]=>
  string(33) "http://myserver/getallheaders.php"
  ["HTTP_TE"]=>
  string(18) "deflate,gzip;q=0.3"
  ["HTTP_CONNECTION"]=>
  string(9) "TE, close"
  ["HTTP_HOST"]=>
  string(7) "ubol.ch"
  ["HTTP_USER_AGENT"]=>
  string(33) "lwp-request/6.09 libwww-perl/6.13"
  ["CONTENT_LENGTH"]=>
  string(2) "28"
  ["CONTENT_TYPE"]=>
  string(8) "text/xml"
  ["HTTP_X_DUMMY"]=>
  string(14) "my test header"
[...]
}

As you can see, the Content-Type and Content-Length headers are being sent and
also end up in the $_SERVER array, but they are not returned by getallheaders.

To be honest I'm not sure if it's a good idea to carry a patch which
changes upstream behavior like this. While it solves the issue for code
that unconditionally calls getallheaders it breaks code (like in my
case) which checks for getallheaders and only uses the function if it
exists. My code was then broken because the getallheaders implementation
was not the same as when running as an Apache module.

I found and investigated this buug on a jessie system, but the patch in
question is the same in the current unstable version of PHP.

Gaudenz



Reply sent to Debian FTP Masters <ftpmaster@ftp-master.debian.org>:
You have taken responsibility. (Fri, 13 Jan 2017 13:07:18 GMT) (full text, mbox, link).


Notification sent to Gaudenz Steinlin <gaudenz@debian.org>:
Bug acknowledged by developer. (Fri, 13 Jan 2017 13:07:18 GMT) (full text, mbox, link).


Message #10 received at 795572-done@bugs.debian.org (full text, mbox, reply):

From: Debian FTP Masters <ftpmaster@ftp-master.debian.org>
To: 413713-done@bugs.debian.org,440775-done@bugs.debian.org,447764-done@bugs.debian.org,500087-done@bugs.debian.org,618462-done@bugs.debian.org,628079-done@bugs.debian.org,639268-done@bugs.debian.org,643282-done@bugs.debian.org,697800-done@bugs.debian.org,715264-done@bugs.debian.org,727143-done@bugs.debian.org,730067-done@bugs.debian.org,731055-done@bugs.debian.org,752100-done@bugs.debian.org,759195-done@bugs.debian.org,760454-done@bugs.debian.org,774154-done@bugs.debian.org,774975-done@bugs.debian.org,776564-done@bugs.debian.org,778596-done@bugs.debian.org,782778-done@bugs.debian.org,783246-done@bugs.debian.org,788060-done@bugs.debian.org,789442-done@bugs.debian.org,789702-done@bugs.debian.org,790472-done@bugs.debian.org,790841-done@bugs.debian.org,792239-done@bugs.debian.org,795572-done@bugs.debian.org,797799-done@bugs.debian.org,799136-done@bugs.debian.org,799851-done@bugs.debian.org,800564-done@bugs.debian.org,801831-done@bugs.debian.org,803260-done@bugs.debian.org,803305-done@bugs.debian.org,805591-done@bugs.debian.org,810244-done@bugs.debian.org,811130-done@bugs.debian.org,814907-done@bugs.debian.org,815794-done@bugs.debian.org,815797-done@bugs.debian.org,817917-done@bugs.debian.org,819139-done@bugs.debian.org,827486-done@bugs.debian.org,828498-done@bugs.debian.org,833133-done@bugs.debian.org,833543-done@bugs.debian.org,834579-done@bugs.debian.org,841618-done@bugs.debian.org,845890-done@bugs.debian.org,846244-done@bugs.debian.org,848661-done@bugs.debian.org,849767-done@bugs.debian.org,664595-done@bugs.debian.org,
Cc: php5@packages.debian.org, php5@packages.qa.debian.org
Subject: Bug#841781: Removed package(s) from unstable
Date: Fri, 13 Jan 2017 13:05:30 +0000
Version: 5.6.26+dfsg-1+rm

Dear submitter,

as the package php5 has just been removed from the Debian archive
unstable we hereby close the associated bug reports.  We are sorry
that we couldn't deal with your issue properly.

For details on the removal, please see https://bugs.debian.org/841781

The version of this package that was in Debian prior to this removal
can still be found using http://snapshot.debian.org/.

This message was generated automatically; if you believe that there is
a problem with it please contact the archive administrators by mailing
ftpmaster@ftp-master.debian.org.

Debian distribution maintenance software
pp.
Scott Kitterman (the ftpmaster behind the curtain)



Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Sat, 11 Feb 2017 07:36:04 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sun Jul 2 02:22:00 2023; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.