Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.1

Bug #5404 Headers cannot be unset
Submitted: 2005-09-14 21:14 UTC
From: gugglegum at gmail dot com Assigned: mike
Status: Closed Package: HTTP_Header
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2005-09-14 21:14 UTC] gugglegum at gmail dot com
Description: ------------ HTTP_Header class declares property $_headers, which initially contains several headers, that are sent by default (you say). This is wrong. At least at my side, PHP does not send any headers that prevent caching. In order to prove it, this is HTTP request made by terminal (manually) to empty PHP-script (script that contains only <?php ?>): -------------------------------------- GET /test.php HTTP/1.1 Host: paul.jetstyle.ru HTTP/1.1 200 OK Date: Wed, 14 Sep 2005 20:58:25 GMT Server: Apache/1.3.33 (Win32) PHP/5.0.5 X-Powered-By: PHP/5.0.5 Transfer-Encoding: chunked Content-Type: text/html 0 -------------------------------------- As you can see here - there are no Pragma and Cache-Control headers. Though maybe it really was in past. My task is to allow clients to cache pages - I'm sending correct Last-Modified header and handle If-Modified-Since http-request header. So, your "Pragma: no-cache" and "Cache-Control: no-store, no-cache, ..." Is a trouble for me. This trouble can be workarounded by resetting these headers but, there is no any way to remove previously assigned header. I do: $httpHeaders->setHeader('pragma', null); $httpHeaders->setHeader('cache-control', null); It works, but these headers still sends empty: -------------------------------------- GET / HTTP/1.1 Host: www.avtoprokat-ekb.ru HTTP/1.1 200 OK Date: Wed, 14 Sep 2005 21:05:04 GMT Server: Apache/1.3.33 (Win32) PHP/5.0.5 X-Powered-By: PHP/5.0.5 pragma: cache-control: last-modified: Wed, 14 Sep 2005 19:40:40 GMT Transfer-Encoding: chunked Content-Type: text/html; charset=windows-1251 -------------------------------------- I think this is unpretty. My suggestion is to keep initially empty $_headers property and add modify setHeader() method, which remove header if it new value === null (not "" or 0).

Comments

 [2005-09-14 21:31 UTC] gugglegum at gmail dot com
I have modified this class for instant needs. You can get my modified version at http://paul.jetstyle.ru/temp/Header.phps
 [2005-09-15 06:55 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2005-09-15 07:17 UTC] gugglegum at gmail dot com
Yes, thank you.