`Content-Type' header issue
| From: | Teodor Cimpoesu | Date: | Fri, 14 Jan 2000 16:32:18 +0000 |
| Subject: | `Content-Type' header issue | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-9124@lists.php.net to get a copy of this message | ||
Hi,
coming back with a known issue of PHP.
[ long ramble, sorry, for the short Q: skip to the end]
As I could see, when there is no Content-Type (CT) header
php sets the default one (SAPI_DEFAULT_CONTENT_TYPE I guess)
the code I've identified is:
[SAPI.c]
249 if (colon_offset) {
250 *colon_offset = 0;
251 if (!STRCASECMP(header_line, "Content-Type")) {
252 SG(sapi_headers).send_default_content_type = 0;
So basically, if we have a CT header, PHP uses it, else it sends the
default one.
But suppose I want to send no content body, what should i do?
I was playing especially with 202 and 204.
e.g.
o 204 - useful to receive a post without actually changing the client
page
(so no more hidden frames to do your job)
o 202 - includes 204 functionality, and , as a plus, I read in the
RFC2068
(yeah I know it's obsoleted by another one) that the server can include
aditional
information w/o sendind a content body, something like a Location:
header where
to redirect the user after the request was accepted.
This can be a neat feature to implement multiple posts (as I sow
questions about
this on the mailing list) using something like
Header ("HTTP/1.1 202 Accepted");
Header ("Location:
http://somewhere.else/some/script.php?$QUERY_STRING");
or something.
But heck, when I try that, the default CT gets in the way.
A script like:
<?
error_log ("slot: $slot1",3,"/tmp/script_log");
Header ("HTTP/1.1 202 Accepted");
Header ("Connection: close");
?>
for a simple form which just sends a slot1 value gives:
HTTP/1.1 202 Accepted
Date: Fri, 14 Jan 2000 15:42:16 GMT
Server: Apache/1.3.9 (Unix) DAV/0.9.14 PHP/4.0b4-dev
X-Powered-By: PHP/4.0b4-dev
Connection: close
Content-Type: text/html
^^^^^^^^^^^^^^^^^^^^^^
which make (least) Netscape forget about 202 and pops up
'Document contains no data...'
-*- Mode: Wandering -*-
So how would one turn off the CT header, or is there a simple to
implement
way to add/remove headers using other ob_* functions?
Thanks for taking your time.
--
CIMPOESU Teodor, Web Programmer
@ DIGICOM S.A. Bucharest, Romania
@ Internet, site development
@ teo@digiro.net , +(401)-330.47.28
official home page ~ http://www.digiro.net/
Internet web page ~ http://internet.digiro.net/