A question about headers (and cookies)

Philip Greenspun's Homepage : Philip Greenspun's Homepage Discussion Forums : 6916 : One Thread
Notify me of new responses
Can anyone explain exactly why the headers returned with an HTTP request must be followed by two newlines for the page to render properly? i tried to set a cookie with the following headers:
"HTTP/1.0 200 OK\n
MIME-Version: 1.0\n
Content-Type: text/html\n
Set-Cookie:  data=value"
(newlines listed explicitly) The page returned correctly in Internet Explorer on my home system. All Netscape Navigator got was the result of [ad_footer], as did IE at work. After looking at the ReturnHeaders code, i tried adding some newlines at the end:
"HTTP/1.0 200 OK\n
MIME-Version: 1.0\n
Content-Type: text/html\n
Set-Cookie:  data=value\n\n"
This works exactly as it should. This requirement is very subtle in pages like quotations.tcl. Why exactly does it work like this?

-- david bessire, May 20, 2000

Answers

Redirect: are two consecutive newlines the accepted delimiter for the end of the HTTP headers?

-- david bessire, May 20, 2000

In a word, yes. Two newlines are the delimiter between the headers and the body. It's somewhere in RFC2068 if you want more details.

-- Nick Strugnell, July 19, 2000