Return-Path: Delivered-To: apmail-httpd-users-archive@www.apache.org Received: (qmail 70925 invoked from network); 18 Feb 2004 11:18:17 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 18 Feb 2004 11:18:16 -0000 Received: (qmail 71275 invoked by uid 500); 18 Feb 2004 11:16:51 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 71255 invoked by uid 500); 18 Feb 2004 11:16:51 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 71241 invoked from network); 18 Feb 2004 11:16:51 -0000 Received: from unknown (HELO 3times25.net) (66.23.202.190) by daedalus.apache.org with SMTP; 18 Feb 2004 11:16:51 -0000 Received: from 3times25.net (localhost [127.0.0.1]) by 3times25.net (Postfix) with ESMTP id 20370B6359 for ; Wed, 18 Feb 2004 06:18:39 -0500 (EST) Message-ID: <40334A0E.4050707@3times25.net> Date: Wed, 18 Feb 2004 06:18:38 -0500 From: Geoffrey User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: users@httpd.apache.org References: <2004217153654.767165@ubbe> In-Reply-To: <2004217153654.767165@ubbe> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Subject: Re: [users@httpd] Help running perl cgi over apache X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Jonas Eckerman wrote: > On Tue, 17 Feb 2004 07:49:22 -0500, Geoffrey wrote: > > >>>> print "Content-type: text/plain\n\n"; > > >>> Shouldn't that be \r\n\r\n on a Linux system? > > >> No. \r is a dos thing, it's a wasted character in the UNIX world. > > > No, \r is not purely a DOS thing. Some protocols specify CRLF as the > line termination, regardless of operating system. > > IIRC the HTTP spec says each header line should be terminated by > CRLF. On a DOS/Windows system \n should result in CRLF and should > therefore be correct, but on a Linix or Unix system \n shpould result > in LF wich means you have to specify \r\n to follow the HTTP > standard. > > If I'm mistaken and the HTTP standard doesn't specify CRLF, then \n > should be correct on a Unix system but not on a DOS/Windows system. I'm too busy (or lazy??) to look up the RFC, but personal experience indicates it's not necessary on a Linux box. I have noted that perl CGI populates each newline in this way though, so it's likely some truth behind it. But, as I've noted, it does work with Apache on a Linux box without it. It appears you may be correct though as little googling did produce the following: The following is an example CGI program that prints one line to your browser. Type in the following, save it to a file called first.pl, and put it in your cgi-bin directory. #!/usr/bin/perl print "Content-type: text/html\r\n\r\n"; print "Hello, World."; Even if you are not familiar with Perl, you should be able to see what is happening here. The first line tells Apache (or whatever shell you happen to be running under) that this program can be executed by feeding the file to the interpreter found at the location /usr/bin/perl. The second line prints the content-type declaration we talked about, followed by two carriage-return newline pairs. This puts a blank line after the header, to indicate the end of the HTTP headers, and the beginning of the body. The third line prints the string ``Hello, World.'' And that's the end of it. -- Until later, Geoffrey Registered Linux User #108567 Building secure systems inspite of Microsoft --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See for more info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org " from the digest: users-digest-unsubscribe@httpd.apache.org For additional commands, e-mail: users-help@httpd.apache.org