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:
> 
> http://validator.w3.org/check?uri=http://yourservernamehere/yourpathhere/

I want the service to do that for me.

The code is right here:

==============
excerpt from:
http://dev.w3.org/cgi-bin/cvsweb/validator/httpd/cgi-bin/check?rev=1.31&content-type=text/x-cvsweb-markup

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

    # this referer handling probably needs fixing to handle strange
cases
    # (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};
        next;
    }
==============

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: http://validator.w3.org/check?uri=$checkee\n\n";
    print "<title>Found</title>\n";
    print "<p>\n";
    print "  Please see <a
href=\"http://validator.w3.org/check?uri=$checkee\">the results of
checking your page.</a>\n";
    print "</p>\n";

    &clean_up_and_exit;

}

> --
> Dan Connolly, W3C
> http://www.w3.org/People/Connolly/

Received on Monday, 6 September 1999 23:09:09 UTC