Received: by taz.hyperreal.com (8.6.12/8.6.5) id FAA28169; Wed, 10 Jul 1996 05:48:51 -0700 Received: from gate.ukweb.com by taz.hyperreal.com (8.6.12/8.6.5) with ESMTP id FAA28162; Wed, 10 Jul 1996 05:48:48 -0700 Received: from star(really [192.168.2.10]) by gate.ukweb.com via rsmtp with smtp id for ; Wed, 10 Jul 96 13:48:45 +0100 (BST) (/\##/\ Smail3.1.30.13 #30.13 built 31-aug-95) Date: Wed, 10 Jul 1996 12:38:01 +0100 (BST) From: Paul Sutton X-Sender: paul@star To: new-httpd@hyperreal.com Subject: ErrorDocument fixes Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-new-httpd@apache.org Precedence: bulk Reply-To: new-httpd@hyperreal.com Has anyone noticed a bug in ErrorDocument if you redirect to a local file and the file doesn't exist? Try putting ErrorDocument 404 /missingfile.html and request a missing file - instead of the 404 message text it'll just print /missingfile.html I've made a patch to fix this. It reports it as a standard recursive error (eg the original error, and then "Additionally, an error occuring processing an ErrorDocument" or whatever). It also fixes the separate bug which caused the leading quote (") to be output on custom-string error documents. A final tidy-up of ErrorDocument handling would be to removed the references to %s from the documentation, as previous reported. I've kept the patch small and easy to read by not re-arranging the if-statement affected. This has left a return in the middle of the function and a {...} block which declares a couple of local variables. This should probably be cleaned up before applying. Paul -- Paul Sutton UK Web Ltd *** ../../../apache_1.1.1/src/http_protocol.c Sun Jun 23 19:05:16 1996 --- ./http_protocol.c Wed Jul 10 13:30:03 1996 *************** *** 880,888 **** if (r->header_only) return; ! if ((custom_response = response_code_string (r, idx))) ! bputs(custom_response, c->client); ! else { char *title = response_titles[idx]; BUFF *fd = c->client; --- 880,908 ---- if (r->header_only) return; ! if ((custom_response = response_code_string (r, idx))) { ! /* ! * We have a custom response output. This should only be ! * a text-string to write back. But if the ErrorDocument ! * was a local redirect and the requested resource failed ! * for any reason, the custom_response will still hold the ! * redirect URL. We don't really want to output this URL ! * as a text message, so first check the custom response ! * string to ensure that it is a text-string (using the ! * same test used in die(), i.e. does it start with a ! * "). If it doesn't, we've got a recursive error, so find ! * the original error and output that as well. ! */ ! if (custom_response[0] == '\"') { ! bputs(custom_response+1, c->client); ! return; ! } ! /* Redirect failed, so get back the original error and fall through ! */ ! while (r->prev && r->prev->status != 200) ! r = r->prev; ! } ! { char *title = response_titles[idx]; BUFF *fd = c->client;