php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23602 Can't Force HTTP/1.0 Over HTTP/1.1
Submitted: 2003-05-12 18:58 UTC Modified: 2003-05-20 08:46 UTC
From: hz11 at nyu dot edu Assigned:
Status: Not a bug Package: HTTP related
PHP Version: 4.3.2RC OS: FreeBSD 4.6.2-RELEASE
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: hz11 at nyu dot edu
New email:
PHP Version: OS:

 

 [2003-05-12 18:58 UTC] hz11 at nyu dot edu
I have a .php setup as an ErrorDocument under Apache 1.3.27, compiled as a DSO.  When an request is made that isn't found, the page is called without issue.  So, I'm trying to set a different header, for example:

header('HTTP/1.0 408 Request Time-out',TRUE,408);

However, the response header always ends up:

HTTP/1.1 408 Request Time-out

on the client.  If I were to change the status code, everything works as expected, yet I can't override the HTTP version.

Is this expected behavior; do I need to force changes like this in Apache's conf, or is it something that could use another look?

Many thanks,

Hans
 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-13 01:42 UTC] helly@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

You need to "SWITCH" the protocol.
 [2003-05-19 10:05 UTC] hans at nyu dot edu
I believe this is a bug in PHP, or at least in how it writes headers through SAPI.c, and is not related to RFC2616 Upgrade/Switch behavior (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.42).

I believe this problem is at:  http://lxr.php.net/source/php4/main/SAPI.c#542

With a call such as header('HTTP/1.0 409'); the HTTP version is never even considered.  The status code is the only thing that is examined and changed.

And, in fact, I'm unsure why PHP/Apache would respond with a HTTP/1.1 header when given a HTTP/1.0 request.  Telnetting to port 80 of my PHP/4.3.2RC2 server and issuing the following request:

GET /test.php HTTP/1.0
Host: test.com

will illicit a HTTP/1.1 response, even when test.php contains:

header('HTTP/1.0 409');

or:

header('101',TRUE,101);
header('Upgrade: HTTP/1.0');

as noted as the way to "Switch" protocols in the RFC, albeit in this case, since the client is me doing a telnet and not a user agent, this would have little bearing.

If someone could take another look at this I'd very much appreciate it.

Hans
 [2003-05-19 20:07 UTC] sniper@php.net
Not PHP problem, Apache replies with HTTP/1.1 always.
(I disabled PHP from my installation and it still says HTTP/1.1 for HTTP/1.0 request)

 [2003-05-20 08:15 UTC] hz11 at nyu dot edu
Thank you for the clarification.  As I had considered at first, http://httpd.apache.org/docs/env.html is the only way to handle this.

My thinking that it was a PHP issue was due to the fact that when setting a header the complete change wasn't occurring, and http://lxr.php.net/source/php4/main/SAPI.c#542 furthered this.  Whether considering only the status, if in fact forcing the protocol is even possible, is another issue, of which I won't get involved in :)

Thank you,

Hans
 [2003-05-20 08:46 UTC] sniper@php.net
restored the original Summary..

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 01:01:30 2024 UTC