Re: /check/referer should redirect

From: Dan Connolly (
Date: Mon, Sep 06 1999

Date: Mon, 6 Sep 1999 23:08:09 -0400 (EDT)
Message-ID: <>
From: Dan Connolly <>
To: Brian Gilkison <>
Subject: Re: /check/referer should redirect

Brian Gilkison wrote:
> Dan,
> The referrer CGI won't work as a bookmark

In its present form, that's true. But it would be a Simple
Matter of Programming to get it to work as expected
(by me, at least).

> -- only works correctly if it
> appears as a link in your "live" documents.  Try changing your bookmark to a
> URL in the format of:

I want the service to do that for me.

The code is right here:

excerpt from:

my $pair;
foreach $pair (split(/[&;,]/, $parameters)) {

    # this referer handling probably needs fixing to handle strange
    # (possibly tied to the explanation given when connections fail;
    # the referer could be on an intranet, etc.)

    if ( $pair eq "/referer" && $ENV{HTTP_REFERER} =~ m,^http://, ) {
        $FORM{uri} = $ENV{HTTP_REFERER};

In stead of doing a sort of "internal redirect" by
setting $FORM{uri}, it should return a 304 redirect.

The code to do a redirect is already there, too:
redirect_to_home_page . Just adapt that to:

sub redirect_to_check {
    my($checkee) = @_;

    $checkee == &url_quot($checkee); # I assume there's an url_quote
				# routine handy; it's gotta be
				# in LWP, if nowhere else.

    print "Status: 302 Found\n";
    print "Content-Type: text/html\n";
    print "Location:$checkee\n\n";
    print "<title>Found</title>\n";
    print "<p>\n";
    print "  Please see <a
href=\"$checkee\">the results of
checking your page.</a>\n";
    print "</p>\n";



> --
> Dan Connolly, W3C