Date: Tue, 24 Jun 2003 14:42:20 +0200 (CEST) From: "Simon L. Nielsen" <simon@nitro.dk> To: FreeBSD-gnats-submit@FreeBSD.org Subject: www/53676: [patch] Don't make people contact doc@ for 404 from non FreeBSD sites Message-ID: <20030624124220.9281C10BF8B@arthur.nitro.dk> Resent-Message-ID: <200306241250.h5OCo5kP054803@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 53676 >Category: www >Synopsis: [patch] Don't make people contact doc@ for 404 from non FreeBSD sites >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-www >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Tue Jun 24 05:50:04 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Simon L. Nielsen >Release: FreeBSD 4.8-STABLE i386 >Organization: >Environment: >Description: The missing-url.cgi script tell people to contact doc@freebsd.org / www@freebsd.org even when coming from a non FreeBSD site. This patch only writes the contact information, if the user is coming from a *.FreeBSD.org site. Not a perfect solution, but it should catch the most cases with bad links to www.FreeBSD.org from sites, which doc@freebsd.org has no control over. This has been tested on 5.1-BETA with perl v5.6.1 and 4.8-STABLE with perl v5.005_03. >How-To-Repeat: >Fix: --- www-cgi-missing-referer.patch begins here --- Index: missing_handler.cgi =================================================================== RCS file: /home/ncvs/www/en/cgi/missing_handler.cgi,v retrieving revision 1.14 diff -u -d -r1.14 missing_handler.cgi --- missing_handler.cgi 18 May 2003 17:45:20 -0000 1.14 +++ missing_handler.cgi 24 Jun 2003 12:26:27 -0000 @@ -75,6 +75,7 @@ # rfc1738 says that ";"|"/"|"?"|":"|"@"|"&"|"=" may be reserved. $http_referer_url = escape2($ENV{'HTTP_REFERER'}); +$freebsd_referer = $http_referer_url =~ m%^http://[^/]*FreeBSD\.org%i; $http_referer_url =~ s/([^a-zA-Z0-9;\/?:&=])/sprintf("%%%02x",ord($1))/eg; $redirect_url_save = escape2($ENV{'REDIRECT_URL'}); $redirect_url_save =~ s/([^a-zA-Z0-9;\/?:&=])/sprintf("%%%02x",ord($1))/eg; @@ -98,14 +99,22 @@ <p>\n}; } +if($freebsd_referer) { + $contact = qq[ +Please contact the members of the +FreeBSD Documentation Project <<A HREF="mailto:freebsd-doc\@FreeBSD.ORG?subject=Document%20not%20found%20-%20http://$http_host$redirect_url_save&body=$http_referer_url">freebsd-doc\@FreeBSD.ORG</A>> +or the server administrator +<a href="mailto:$server_admin?subject=Document%20not%20found%20-%20http://$http_host$redirect_url_save&body=$http_referer_url">$server_admin</a>. +]; +} else { + $contact = ""; +} print qq[ The closest match to your request is <a href="http://$server_name">http://$server_name</a>. -Please contact the members of the -FreeBSD Documentation Project <<A HREF="mailto:freebsd-doc\@FreeBSD.ORG?subject=Document%20not%20found%20-%20http://$http_host$redirect_url_save&body=$http_referer_url">freebsd-doc\@FreeBSD.ORG</A>> -or the server administrator -<a href="mailto:$server_admin?subject=Document%20not%20found%20-%20http://$http_host$redirect_url_save&body=$http_referer_url">$server_admin</a>.<p> +$contact +<p> <center> Please try our --- www-cgi-missing-referer.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030624124220.9281C10BF8B>