Re: POST on redirects?
| From: | Chris Shiflett | Date: | Mon, 07 Aug 2006 14:29:18 +0000 |
| Subject: | Re: POST on redirects? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-240257@lists.php.net to get a copy of this message | ||
Adam Zey wrote:
> function make_post($message)
> {
> $headers .= "POST /foo.php HTTP/1.1\r\n";
> $headers .= "Host: bar.com\r\n";
> $headers .= "Content-Type: application/octet-stream\r\n";
> $headers .= "Connection: keep-alive\r\n";
> $headers .= "Content-Length: " . strlen($message) . "\r\n";
> $headers .= "\r\n";
> return $headers . $message;
> }
>
> As far as I can tell, these are the absolute minimum set of
> headers you can get away with for a POST transaction (If you
> know how to use less, let me know, I use this in a situation
> where overhead matters).
Your Connection header is redundant, since that's the default value in
HTTP/1.1.
I would send the header but give it a value of close, since I see no
good reason to leave the TCP connection open until it times out. That's
a pretty big waste in a situation where overhead matters.
Hope that helps.
Chris
--
Chris Shiflett
Principal, OmniTI
http://omniti.com/