CGI-BIN Perl Script Not Routed Back to Browser using Apache

CGI-BIN Perl Script Not Routed Back to Browser using Apache

Post by Robert Gid » Mon, 02 Sep 2002 08:07:17



I recently installed Debian 3.0.  Using Apache, to test a perl script (before
installing MySQL), it appears to find the localhost cgi-bin and execute it,
but the browser doesn't display the output.  Instead, a window pops up with
the following:

        "Open 'http://localhost/cgi-bin/first.pl'?

Under that, three buttons:

        "Save to disk"    "Open"    "Cancel"

When choosing "Open", I selected an editor which appeared with the correct
Perl output.  Obviously, the script was found and executed.

I would expect I've a simple step to follow or correct to get the output
routed to the browser - hopefully in 'httpd.conf'?  Any suggestions?

Thanks,  Rob Giden

 
 
 

CGI-BIN Perl Script Not Routed Back to Browser using Apache

Post by Joshua Sliv » Mon, 02 Sep 2002 08:28:57



> I recently installed Debian 3.0.  Using Apache, to test a perl script (before
> installing MySQL), it appears to find the localhost cgi-bin and execute it,
> but the browser doesn't display the output.  Instead, a window pops up with
> the following:
>    "Open 'http://localhost/cgi-bin/first.pl'?

What "Content-Type" is the script sending?

--
Joshua Slive

Apache HTTP Server Users Mailing List: http://httpd.apache.org/userslist.html

 
 
 

CGI-BIN Perl Script Not Routed Back to Browser using Apache

Post by David Efflan » Tue, 03 Sep 2002 05:20:48



Quote:> I recently installed Debian 3.0.  Using Apache, to test a perl script (before
> installing MySQL), it appears to find the localhost cgi-bin and execute it,
> but the browser doesn't display the output.  Instead, a window pops up with
> the following:

>    "Open 'http://localhost/cgi-bin/first.pl'?

> Under that, three buttons:

>    "Save to disk"    "Open"    "Cancel"

> When choosing "Open", I selected an editor which appeared with the correct
> Perl output.  Obviously, the script was found and executed.

> I would expect I've a simple step to follow or correct to get the output
> routed to the browser - hopefully in 'httpd.conf'?  Any suggestions?

That is something I might expect to happen using MSIE as a client on a Win
box with Perl installed.  MSIE is not MIME compliant and often uses its
own methods to determine Content-type (especially text/plain which it
considers ambiguous).

The only reason I think that could happen with a Linux browser is if you
munged the Content-type header in the script output.  What Content-type
did your script print and did you follow the last header line with a blank
line (or double newline)?

If you use the Perl CGI module, it has a header object or function that
can output proper headers, assuming that you specify the -type for
anything other than text/html.

If you want to see what what is in the http headers, you could either use
the option for wget to display headers, or 'telnet localhost 80' and enter
the following followed by a blank line (hit enter key an extry time).

HEAD /cgi-bin/first.pl HTTP/1.0

Or use GET instead of HEAD to see full output.

--
David Efflandt - All spam ignored  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/

 
 
 

CGI-BIN Perl Script Not Routed Back to Browser using Apache

Post by Robert Gid » Wed, 04 Sep 2002 01:31:23


Thanks to both Joshua and David,

Both replies were on target - with a troublesome followup I'll check
up on:

My Content-type was text/plain so I changed it to text/html while
including
html tags I know should work.  Still the same problem.  --  Then I
changed
the ".pl" extension to ".cgi" and THAT worked.   I checked httpd.conf
and all "cgi, pl and sh" extensions are id'd, so I don't know why the
".pl" didn't work (I'm guessing Perl didn't accept it).  Anyway, I've
installed MySQL and am on my way using only ".cgi".

Thanks,
Rob Giden


> I recently installed Debian 3.0.  Using Apache, to test a perl script (before
> installing MySQL), it appears to find the localhost cgi-bin and execute it,
> but the browser doesn't display the output.  Instead, a window pops up with
> the following:

>    "Open 'http://localhost/cgi-bin/first.pl'?

> Under that, three buttons:

>    "Save to disk"    "Open"    "Cancel"

> When choosing "Open", I selected an editor which appeared with the correct
> Perl output.  Obviously, the script was found and executed.

> I would expect I've a simple step to follow or correct to get the output
> routed to the browser - hopefully in 'httpd.conf'?  Any suggestions?

> Thanks,  Rob Giden

 
 
 

1. /cgi-bin/phf /cgi-bin/test-cgi /cgi-bin/handler

I've been seeing a number of attacks of this sort recently
from various sites in the http logs.  The time correlation
between the logs on various hosts suggests that the attacker
was scanning sequentially upward in IP addresses.  Since all
tcp and udp packets to ports below 1024 except for http,
smtp, and ident are filtered out for most, including the
attacking, sites, I'm not seeing anything else in the logs.

209.61.73.47 - - [04/Jul/1998:07:19:27 -0500] "GET /cgi-bin/phf" 404 -
209.61.73.47 - - [04/Jul/1998:07:19:28 -0500] "GET /cgi-bin/test-cgi" 404 -
209.61.73.47 - - [04/Jul/1998:07:19:28 -0500] "GET /cgi-bin/handler" 404 -

Is this a signature of some known attackware?  If so, what
other attacks accompany these http probes?

--

2. Welcome to comp.unix.shell [Frequent posting]

3. apache: cgi script not in cgi-bin

4. Finding Good PHP Sites for Jobs

5. apache: give /home/mailman/cgi-bin permissions to run cgi-scripts.

6. Equivalent of BSD Cbreak mode in POSIX line discipline?

7. Apache virtual host - cgi-bin always refer back to main document root !?

8. Connection=OK ; Transfer=nul

9. Apache cgi-bin / perl

10. Apache/perl cgi-bin question ?

11. cgi-bin/view-source?cgi-bin/view-source

12. Redirect cgi (perl) scripts using Apache 0.8.14

13. Linux/Apache - my cgi-bin script can't write/redirect files in any directory