delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/23/18:50:48

From: Richard Dawe <richdawe AT bigfoot DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: DJGPP & CGI
Date: Thu, 23 Mar 2000 19:02:19 +0000
Organization: Customer of Planet Online
Lines: 46
Message-ID: <38DA6A3B.8C6E86C@bigfoot.com>
References: <38D7C78E DOT 2708CFD1 AT pgmincorporated DOT com> <38D7E7D1 DOT D14B432F AT bigfoot DOT com> <3L7C4.1782$AU DOT 144773 AT weber DOT videotron DOT net> <200003230133 DOT GAA00899 AT midpec DOT com>
NNTP-Posting-Host: modem-132.arizona.dialup.pol.co.uk
Mime-Version: 1.0
X-Trace: newsg1.svr.pol.co.uk 953851464 4800 62.137.54.132 (23 Mar 2000 22:44:24 GMT)
NNTP-Posting-Date: 23 Mar 2000 22:44:24 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.14 i586)
X-Accept-Language: de,fr
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019