diff --git a/cgigw/cgigw.cgi b/cgigw/cgigw.cgi new file mode 100644 index 0000000..0ec77db --- /dev/null +++ b/cgigw/cgigw.cgi @@ -0,0 +1,106 @@ +#!/usr/bin/perl +# +# $Id: cgigw.cgi,v 1.1 1998-04-28 22:01:23 hjp Exp $ +# +# This is a simpe CGI gateway script. +# +# It can be used to access CGI scripts on a different server and/or +# port. +# Possible scenarios where this is useful: +# * Your real CGI scripts have to run on a machine behind a firewall. +# In this case you may also want to modify this script to check +# parameters. +# * Your real CGI scripts have to run on a different server (e.g., one +# with some special database installed), but you don't want to expose +# that server's address in your URLs. +# * Your real CGI scripts have to run on a Web server which doesn't +# speak SSL. +# +# Usage: Change the customization section to point to the script which +# you really want to call. Install this script in some convenient +# place. Make sure the target script generates only links to your +# "official" server (If this is not possible, you might want to +# tweak its output just before "print @rest;" at the very bottom +# of this script. +# +# $Log: cgigw.cgi,v $ +# Revision 1.1 1998-04-28 22:01:23 hjp +# Initial release. +# Only tested with a few CGIs and the Roxen web server. +# +# + +use IO::Socket; + +# BEGIN customization section +$serv_addr = "internal.host.com"; +$serv_port = 80; +$serv_script = "/some/script.cgi"; +# END customization section + +$sock = IO::Socket::INET->new(PeerAddr => $serv_addr, + PeerPort => $serv_port); +if (!$sock) { + print "Status: 500\r\n"; + print "Content-type: text/html\r\n"; + print "\r\n"; + print "
\n"; + print "