Mail Archives: djgpp/2000/03/23/18:50:48
Hello.
Prashant TR wrote:
>
> "Martin Peach" <martin AT vr-labs DOT com> proclaimed:
>
> > Richard Dawe <richdawe AT bigfoot DOT com> wrote in message
> > news:38D7E7D1 DOT D14B432F AT bigfoot DOT com...
> > > Shouldn't that be:
> > >
> > > printf("Content-Type: text/html\n\n");
> > Shouldn't that be printf("Content-Type: text/html\r\n");
> > You are supposed to put the CRLF pair at the end of html lines...
>
> No, you need two newlines, or else the server is going to reject that
> cgi script.
I wasn't particularly conscious that night. I actually meant this:
printf("Content-Type: text/html\r\l\r\l");
From RFC 2068, the HTTP/1.1 spec:
"HTTP/1.1 defines the sequence CR LF as the end-of-line marker for all
protocol elements except the entity-body (see appendix 19.3 for
tolerant applications). The end-of-line marker within an entity-body
is defined by its associated media type, as described in section 3.7.
CRLF = CR LF"
where:
"CR = <US-ASCII CR, carriage return (13)>
LF = <US-ASCII LF, linefeed (10)>"
Since "\n" = CRLF for text mode I/O with DJGPP, this a moot point. On Unix
\n = \l. Fortunately it also says in the HTTP/1.1 spec that applications
can ignore the leading CR of the CRLF or accept just an LF if they want,
presumably to avoid this \n = \r\l vs. \n = \l mess. So double \n is OK,
and I really shouldn't post when I'm tired. =o
Bye,
--
Richard Dawe
richdawe AT bigfoot DOT com ICQ 47595498 http://www.bigfoot.com/~richdawe/
- Raw text -