[Tutor] Problems serving up PDF

Luke Paireepinart rabidpoobear at gmail.com
Fri Sep 15 05:07:04 CEST 2006


>> One note, you should be using \r\n instead of \n.
>>     
>
>   Both development and deployment are on a linux OS, so
>   this is the correct procedure. However, I don't think that
>   using '\r' does any harm on *nix.... 
>   in fact, it would be the more portable approach. 
>   Thanks for pointing that out.
>
>   
Yes, but when developing a server-side CGI script that's returning HTML 
with headers,
you're supposed to always use '\r\n' no matter
what platforms the browsers or the server run on.  It's part of some 
specification I'd guess.

>> Also, you're putting \r\n\r\n after your header, right?
>>     
>  
>    Not sure what you mean. Either of the functions provide the
>    header. Could you explain further?
>    regards
>    tim
>   
I by no means claim to be an expert at web development.
However, I wrote a few simple CGI scripts, and when you're making a header,
it goes something like this:

Content-type: text/plain\r\n
\r\n
\r\n
<html>\r\n
    <head>\r\n
        <title> hello </title>\r\n
    </head>\r\n
    <body>\r\n
        Hi\r\n
    </body>\r\n
</html>\r\n

You need those two extra returns so that the browser knows it's done 
reading the header
and it should start decoding the html code.
That's all I was referring to.
I don't know if you are supposed to use \r\n always or just in the 
header section,
but I bet browsers would handle either case just fine.

That's just my opinion on all this stuff.
Use \n if it works, I guess.
If you think I might be right, investigate further.
HTH,
-Luke
> [snip]
>
>   



More information about the Tutor mailing list