#23759 [Asn->Csd]: PHP doesn't preserve subrequest status
| From: | iliaa@php.net | Date: | Fri, 23 May 2003 02:43:05 +0000 |
| Subject: | #23759 [Asn->Csd]: PHP doesn't preserve subrequest status | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-40246@lists.php.net to get a copy of this message | ||
ID: 23759
Updated by: iliaa@php.net
Reported By: jaboydjr at netwalk dot com
-Status: Assigned
+Status: Closed
Bug Type: Apache2 related
Operating System: Linux 2.4.20
PHP Version: 4.3.2RC4
Assigned To: iliaa
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2003-05-22 17:43:54] sniper@php.net
Ilia promised to look into this.
------------------------------------------------------------------------
[2003-05-22 15:04:42] jaboydjr at netwalk dot com
I attempted to use PHP for "branding" Apache2 error documents, and
noticed
that it always returns status 200. In order for PHP to work correctly
in
this situation, it must return the status it is given. This is
especially
important for 401 status codes, since a browser must receive the 401
code
in order to know to present an authorization dialogue to the user.
The attached patch works for me to fix this problem; consider it just
a
workaround patch if you wish. The patch simply preserves non-zero
request
codes passed in, and sets status HTTP_OK (=200) if 0 is passed in.
==============================================================================
--- php-4.3.2RC4-orig/sapi/apache2filter/sapi_apache2.c 2003-05-21
05:34:14.000000000 -0400
+++ php-4.3.2RC4/sapi/apache2filter/sapi_apache2.c 2003-05-22
15:43:09.000000000 -0400
@@ -376,7 +376,8 @@
const char *auth;
PG(during_request_startup) = 0;
- SG(sapi_headers).http_response_code = 200;
+ SG(sapi_headers).http_response_code =
+ (!f->r->status ? HTTP_OK : f->r->status);
SG(request_info).content_type = apr_table_get(f->r->headers_in,
"Content-Type");
#undef safe_strdup
#define safe_strdup(x) ((x)?strdup((x)):NULL)
--- php-4.3.2RC4-orig/sapi/apache2handler/sapi_apache2.c 2003-05-21
05:34:14.000000000 -0400
+++ php-4.3.2RC4/sapi/apache2handler/sapi_apache2.c 2003-05-22
15:43:09.000000000 -0400
@@ -412,7 +412,7 @@
char *content_type;
const char *auth;
- SG(sapi_headers).http_response_code = 200;
+ SG(sapi_headers).http_response_code = (!r->status ? HTTP_OK :
r->status);
SG(request_info).content_type = apr_table_get(r->headers_in,
"Content-Type");
SG(request_info).query_string = apr_pstrdup(r->pool, r->args);
SG(request_info).request_method = r->method;
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=23759&edit=1