From simon@arthur.nitro.dk Tue Jun 24 05:42:22 2003 Return-Path: Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CA26E37B401 for ; Tue, 24 Jun 2003 05:42:22 -0700 (PDT) Received: from arthur.nitro.dk (port324.ds1-khk.adsl.cybercity.dk [212.242.113.79]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2DB4743FDD for ; Tue, 24 Jun 2003 05:42:22 -0700 (PDT) (envelope-from simon@arthur.nitro.dk) Received: by arthur.nitro.dk (Postfix, from userid 1000) id 9281C10BF8B; Tue, 24 Jun 2003 14:42:20 +0200 (CEST) Message-Id: <20030624124220.9281C10BF8B@arthur.nitro.dk> Date: Tue, 24 Jun 2003 14:42:20 +0200 (CEST) From: "Simon L. Nielsen" Reply-To: "Simon L. Nielsen" To: FreeBSD-gnats-submit@freebsd.org Cc: Subject: [patch] Don't make people contact doc@ for 404 from non FreeBSD sites X-Send-Pr-Version: 3.113 X-GNATS-Notify: >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: simon >State: closed >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Tue Jun 24 05:50:04 PDT 2003 >Closed-Date: Mon Mar 19 21:19:55 GMT 2007 >Last-Modified: Mon Mar 19 21:19:55 GMT 2007 >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 @@

\n}; } +if($freebsd_referer) { + $contact = qq[ +Please contact the members of the +FreeBSD Documentation Project <freebsd-doc\@FreeBSD.ORG> +or the server administrator +$server_admin. +]; +} else { + $contact = ""; +} print qq[ The closest match to your request is http://$server_name. -Please contact the members of the -FreeBSD Documentation Project <freebsd-doc\@FreeBSD.ORG> -or the server administrator -$server_admin.

+$contact +

Please try our --- www-cgi-missing-referer.patch ends here --- >Release-Note: >Audit-Trail: Responsible-Changed-From-To: freebsd-www->simon Responsible-Changed-By: simon Responsible-Changed-When: Sun Jul 20 15:52:42 PDT 2003 Responsible-Changed-Why: I will handle my own PR's. http://www.freebsd.org/cgi/query-pr.cgi?pr=53676 State-Changed-From-To: open->closed State-Changed-By: gabor State-Changed-When: Mon Mar 19 21:19:22 UTC 2007 State-Changed-Why: This problem does not exist any more. http://www.freebsd.org/cgi/query-pr.cgi?pr=53676 >Unformatted: