ID:               38602
 User updated by:  tomsn at inetoffice dot com
 Reported By:      tomsn at inetoffice dot com
-Status:           No Feedback
+Status:           Open
 Bug Type:         Apache2 related
 Operating System: Linux
 PHP Version:      5.1.5
 New Comment:

The reported bug is not related to setting a Status.

Rather, it describes a problem with setting the HTTP result protocol
version to 1.0. The docs and specs are very clear that this should be
possible, as described in the bug. It is not currently possible with
Apache.


Previous Comments:
------------------------------------------------------------------------

[2006-09-04 01:00:01] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------

[2006-08-27 22:31:02] [EMAIL PROTECTED]

You need to send the Status header to change the status.

------------------------------------------------------------------------

[2006-08-26 00:02:39] tomsn at inetoffice dot com

Description:
------------
Steps:
1. Create a php script with header("HTTP/1.0 200 OK") at the end. That
call is documented to change the protocol number of the response to
1.0.
2. Use mod_dumpio in Apache2 to observe the sent headers from any
HTTP/1.1 request, or you can use Firefox Live HTTP Headers header
watcher, or whatever.
RESULT: Apache sends HTTP/1.1 200 OK as the response header.
EXPECT: Apache to respect your wishes and send HTTP/1.0 200 OK as the
response header.

DIAGNOSES:
The problem results from the way Apache2 tracks the pieces of the
resultant status line seperately. The httpd.h structure request_rec has
fields status_line, status, and proto_num. These are analyzed and
combined within Apache in a mystical and magical way. The fix to this
bug is to give it an updated proto_num and to send it a special
apache_setenv().

DETAILS:

sapi/apache2handler/sapi_apache2(121) -- 
  php_apache_sapi_send_headers()

Has the following code used to transmit the HTTP response status line
to Apache:

/* httpd requires that r->status_line is set to the first digit of
* the status-code: */
if (sline && strlen(sline) > 12 && strncmp(sline, "HTTP/1.", 7) == 0 
        && sline[8] == ' ') {
        ctx->r->status_line = apr_pstrdup(ctx->r->pool, sline + 9);
}

Insert into that code the following line just before the end curly:
      ctx->r->proto_num = 1000 + (sline[7]-'0');

That funky 1000 + expression is how apache2 tracks HTTP protocol
numbers internally. See their HTTP_VERSION() macro.

NOW, although this added line of code sends Apache an accurate status
line protocol number, Apache is in the habit of ignoring it. To force
Apache to really use it, you can either code the following
apache_setenv() into PHP as a special case of send headers, or you can
document for the user that they need to call it from their script. The
call is:
    apache_setenv( "force-response-1.0", "true" );

I hope this is of some use to you. Thanks for all the excellent work in
building and maintaining PHP.

Reproduce code:
---------------
header("HTTP/1.0 200 OK");

Expected result:
----------------
Browser to receive this header:

HTTP/1.0 200 OK

Actual result:
--------------
Browser receives this header:

HTTP/1.1 200 OK


(notice the last 1 in /1.1)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=38602&edit=1

Reply via email to