Setting HTTP results code vs. HTTP type

From: Date: Mon, 30 Apr 2007 16:35:33 +0000
Subject: Setting HTTP results code vs. HTTP type
Groups: php.internals 
Request: Send a blank email to internals+get-29113@lists.php.net to get a copy of this message
Hi all, I ran into the following problem I would like to get an opinion on: We noticed that our website returns a HTTP/1.1 chunked response even when the request was a HTTP/1.0 request (e.g. php file_get_contents). What happens: - Wordpress (wrongly) set the result code with a hardcoded @header("HTTP/1.1 $header $text", true, $header); - PHP 5.2.1 (IMHO wrongly) patches the protocol in sapi/apache2handler/sapi_apache2.c function php_apache_sapi_send_headers, probably because "force-response-1.1" does not exist (at least not in any production version): ctx->r->proto_num = 1000 + (sline[7]-'0'); - Apache thinks the request was 1.1 and under some circumstances decides to switch to Transfer-Encoding chunked. I think the following should be done: - Ask Wordpress to use $_SERVER['SERVER_PROTOCOL'] when available instead of a hardcoded HTTP/1.1 (I'll do that) - Update the PHP header() documentation to mention this. I was also thinking that supporting/documenting header(null, true, 404); or the like would be nice for people who only want to set the return code and leave the HTTP type unchanged. - Maybe change php_apache_sapi_send_headers to not mess with proto_num. This make it impossible to force the response to HTTP/1.1 but I don't think that should be done anyway as the client might not expect it. For the same reason I think the line apr_table_set(ctx->r->subprocess_env, "force-response-1.1", "true"); should probably be removed as well... Should I open a bug report on this? Regards, - Chris

« previous php.internals (#29113) next »