> -----Original Message-----
> From: David Zhuo [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 21, 2002 1:41 PM
> To: Bob Showalter
> Cc: [EMAIL PROTECTED]
> Subject: RE: Help!! Retrieving Image File
> 
> 
> On Wed, 2002-08-21 at 10:44, Bob Showalter wrote:
> > > -----Original Message-----
> > > From: David Zhuo [mailto:[EMAIL PROTECTED]]
> > > Sent: Wednesday, August 21, 2002 1:12 PM
> > > To: Connie Chan
> > > Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; cgi mailing list
> > > Subject: Re: Help!! Retrieving Image File
> > > 
> > > 
> > > where do you get the impression that \n\n is for text file 
> > > and \r\n\r\n
> > > is for binary data??? did you get that somewhere? \r\n\r\n is OS
> > > specific but \n\n is portable. does Win32 and UNIX-ish 
> use the same
> > > crlf? your best beat is to use \n\n where Perl will
> > > translate(transparently in the background) that into 
> whatever correct
> > > crlf your OS uses. if you use \r\n\r\n, you are asking your 
> > > code not to
> > > be portable.
> > 
> > \r\n (or better, \015\012; see perldoc perlport) is the 
> proper terminator
> > for HTTP response header lines, per RFC 2616. Since the 
> header must be
> > separated from the response body by a blank line, "Content-Type:
> > image/jpeg\r\n\r\n" is an RFC-compliant header. Most 
> clients will accept \n
> > alone, but they are not required to by the spec.
> 
> true but you don't have to \015\012 or even \r\n and the reason is
> because Perl automatically translate that for you when it 
> sees \n\n, it
> knows the OS that you are running on and \n is special in Perl

The format for HTTP response headers is unrelated to the OS you are running.
Client and server may be running different OS's for that matter. 

ASCII \015\012 is the correct terminator, *not* \n.

Check out the source of CGI.pm to see how it handles HTTP response headers
and you'll see what I mean. CGI.pm also binmode's STDOUT on WinXXX
platforms.

All this stuff will make your head swim, which is a very good reason to use
CGI.pm!

Cheers.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to