On Mon, 25 Jan 2010 21:26:05 +0000, Ashley Sheridan wrote:

> On Mon, 2010-01-25 at 22:13 +0100, Nisse Engström wrote:
>> The HTTP spec allows cookies to be sent after the content,
>> in trailing headers, but it's not usable practically. Few
>> browsers support it, and PHP certainly doesn't. You'd have
>> to write a CGI to get away with it.
>> The only user agents I know of that support trailers are
>> the WC3 and WDG validators, and Opera(!).

[...and one (and a half) of my own tools...]

> I didn't even know that that was possible. I'm glad in a way that the
> other browsers and PHP don't support it, as it would make a lot of
> things more difficult if not impossible to accomplish!

What do you have in mind?

It would certainly make Clancy's job easier. Imagine...

    header ("Trailer: Cookie");
    /* PHP takes notice! */

    echo '<!DOCTYPE HTML PUBLIC...and so on and so forth...';
    setcookie (...);
    echo '<p>Some more stuff...';

* If the program exits before the headers have been sent
  (eg. output buffering), PHP sends the headers as usual,
  with "Content-Length:" and "Set-Cookie:", but skips the
* If the headers have to be sent before the program has
  exited, PHP sends "Content-Encoding: chunked" and
  "Trailer:", and buffers any further header() or
  setcookie() calls.
  When the program does exit, PHP sends all the buffered
  headers, and perhaps logs warnings for any headers that
  are not allowed in the trailers or has not been announced
  in the "Trailer:" header.

Ah, it could have worked. It would have been great fun
writing the code to do it. (Writing output filters that
switch between "Content-Length" and "chunked", and HTTP
1.0 and 1.1 was interesting).

Actually, now that I think about it, I don't think I have
actually tested the above in PHP. I'd be very surprised
if it worked though. :-)


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to