From owner-freebsd-questions@FreeBSD.ORG Wed Oct 1 11:00:04 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 34E0916A4B3 for ; Wed, 1 Oct 2003 11:00:04 -0700 (PDT) Received: from remt29.cluster1.charter.net (remt29.cluster1.charter.net [209.225.8.39]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6783D43FF7 for ; Wed, 1 Oct 2003 11:00:03 -0700 (PDT) (envelope-from chowse@charter.net) Received: from [66.168.145.25] (HELO moe) by remt29.cluster1.charter.net (CommuniGate Pro SMTP 4.0.6) with ESMTP id 10358395; Wed, 01 Oct 2003 13:59:59 -0400 From: "Charles Howse" To: "'Charles Howse'" , Date: Wed, 1 Oct 2003 12:59:53 -0500 Message-ID: <005e01c38845$d0e42740$04fea8c0@moe> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2616 Importance: Normal In-Reply-To: <005901c3883e$12780030$04fea8c0@moe> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Subject: RE: Perl cgi redirect not working - Partially solved X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Oct 2003 18:00:04 -0000 > Hi, > I'm *copying an example* perl cgi script from "FreeBSD Unleashed" pp. > 699. > I have 2 issues. >=20 > 1. The redirect on the last line isn't working. It opens a blank page > and prints the text "Location: http://howse.no-ip.org/thanks.shtml". > That's not what I want. I want to open the page thanks.shtml. >=20 > 2. I can't see the text in the book clear enough to know whether the > characters I've marked with ^ should be dashes or tildies. >=20 > I've Googled for the redirect, and tried a few examples, no joy. > Would someone be kind enough to help? >=20 >=20 > #!/usr/bin/perl >=20 > read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); > @pairs =3D split(/&/, $buffer); > foreach $pair (@pairs) > { > ($name, $value) =3D split(/=3D/, $pair); > $value =3D~ tr/+/ /; > ^ > $value =3D~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; > ^ > $value =3D~ s/~!/ ~!/g; > ^ ^ ^=20 > $FORM{$name} =3D $value; > } >=20 > print "Content-type: text/html\n\n"; >=20 > open (MAIL,"| /usr/sbin/sendmail -oi -t"); > print MAIL "From: $FORM{'name'} <$FORM{'email'}>\n"; > print MAIL "To: charles\n"; > print MAIL "Subject: Contact form output\n\n"; > print MAIL "$FORM{'name'}, from $ENV{'REMOTE_HOST'} > ($ENV{'REMOTE_ADDR'}), has sent you the following comment:\n\n"; > print MAIL "$FORM{'comment'}\n"; > close (MAIL); >=20 > print "Location: http://howse.no-ip.org/thanks.shtml\n\n"; I removed the print "Content-type: text/html\n\n"; line, and now the redirect works. Still awaiting some input on the 2nd issue.