You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jeff Trawick <tr...@bellsouth.net> on 2000/09/01 20:09:23 UTC
[PATCH] filtering and canned error responses
Jeff Trawick <tr...@bellsouth.net> writes:
> For the purposes of this discussion, "canned error responses" are
> those strings generated by ap_send_error_response().
>
> Currently, there is non-sensical filtering done on this text. Normal
> request processing triggered modules to set up filtering appropriate
> to the original request. But the original request failed for some
> reason and now we're creating an error message. Should content
> filters see this message?
>
> I think that these messages should be passed to the connection
> filters, skipping the content filters.
>
> An example problem:
>
> Tell Apache that pages in root/1047 are in character set IBM-1047.
> Ask for non-existent file root/1047/index.html. mod_charset_lite sets
> up a translation filter. The only content is the "404 Not Found"
> document, which is in iso-8859-1, but mod_charset_lite translates it
> as if it were IBM-1047, resulting in garbage.
>
> mod_charset_lite might be able to perform extra checks to detect this
> situation, but I'm thinking that in general all content filters could
> run into non-sensical (or at least unnecessary) processing.
>
> Comments?
>
> --
> Jeff Trawick | trawick@ibm.net | PGP public key at web site:
> http://www.geocities.com/SiliconValley/Park/9289/
> Born in Roswell... married an alien...
>
This patch implements the suggestion described above... It is
intended to work for the messages hard-coded in apache as well as
ErrorDocument literal strings (e.g., `ErrorDocument 404 "You're such a
loser"').
Any concerns to discuss?
It seems likely that rvputs_canned_msg() will eventually indicate in
the buckets it creates that the strings are in the implementation
character set. Such a flag could be used to trigger translation of
these error strings as well as chunk headers/trailers and headers.
Unclear...
Index: main/http_protocol.c
===================================================================
RCS file: /home/cvspublic/apache-2.0/src/main/http_protocol.c,v
retrieving revision 1.118
diff -u -r1.118 http_protocol.c
--- main/http_protocol.c 2000/08/30 01:09:03 1.118
+++ main/http_protocol.c 2000/09/01 17:38:26
@@ -2624,6 +2624,37 @@
return written;
}
+static int rvputs_canned_msg(request_rec *r, ...)
+{
+ ap_bucket_brigade *bb = NULL;
+ apr_ssize_t written;
+ va_list va;
+
+ if (r->connection->aborted)
+ return EOF;
+ bb = ap_brigade_create(r->pool);
+ va_start(va, r);
+ written = ap_brigade_vputstrs(bb, va);
+ va_end(va);
+ if (written != 0) {
+ /* This is canned text which should not be processed by content
+ * filters, so find the first connection filter and hand it
+ * the brigade.
+ */
+ ap_filter_t *f = r->filters;
+
+ /* XXX: check should be "ftype != AP_FTYPE_CONNECTION", but we're
+ * playing tricks currently with the types of chunk_filter and
+ * core_filter
+ */
+ while (f->ftype == AP_FTYPE_CONTENT) {
+ f = f->next;
+ }
+ ap_pass_brigade(f, bb);
+ }
+ return written;
+}
+
API_EXPORT(int) ap_rflush(request_rec *r)
{
/* ### this is probably incorrect, but we have no mechanism for telling
@@ -2762,7 +2793,7 @@
* the original error and output that as well.
*/
if (custom_response[0] == '\"') {
- ap_rputs(custom_response + 1, r);
+ rvputs_canned_msg(r, custom_response + 1, NULL);
ap_finalize_request_protocol(r);
ap_rflush(r);
return;
@@ -2794,187 +2825,187 @@
/* folks decided they didn't want the error code in the H1 text */
h1 = &title[4];
- ap_rvputs(r,
- DOCTYPE_HTML_2_0
- "<HTML><HEAD>\n<TITLE>", title,
- "</TITLE>\n</HEAD><BODY>\n<H1>", h1, "</H1>\n",
- NULL);
+ rvputs_canned_msg(r,
+ DOCTYPE_HTML_2_0
+ "<HTML><HEAD>\n<TITLE>", title,
+ "</TITLE>\n</HEAD><BODY>\n<H1>", h1, "</H1>\n",
+ NULL);
switch (status) {
case HTTP_MOVED_PERMANENTLY:
case HTTP_MOVED_TEMPORARILY:
case HTTP_TEMPORARY_REDIRECT:
- ap_rvputs(r, "The document has moved <A HREF=\"",
- ap_escape_html(r->pool, location), "\">here</A>.<P>\n",
- NULL);
+ rvputs_canned_msg(r, "The document has moved <A HREF=\"",
+ ap_escape_html(r->pool, location), "\">here</A>.<P>\n",
+ NULL);
break;
case HTTP_SEE_OTHER:
- ap_rvputs(r, "The answer to your request is located <A HREF=\"",
- ap_escape_html(r->pool, location), "\">here</A>.<P>\n",
- NULL);
+ rvputs_canned_msg(r, "The answer to your request is located <A HREF=\"",
+ ap_escape_html(r->pool, location), "\">here</A>.<P>\n",
+ NULL);
break;
case HTTP_USE_PROXY:
- ap_rvputs(r, "This resource is only accessible "
- "through the proxy\n",
- ap_escape_html(r->pool, location),
- "<BR>\nYou will need to ",
- "configure your client to use that proxy.<P>\n", NULL);
+ rvputs_canned_msg(r, "This resource is only accessible "
+ "through the proxy\n",
+ ap_escape_html(r->pool, location),
+ "<BR>\nYou will need to ",
+ "configure your client to use that proxy.<P>\n", NULL);
break;
case HTTP_PROXY_AUTHENTICATION_REQUIRED:
case HTTP_UNAUTHORIZED:
- ap_rputs("This server could not verify that you\n"
- "are authorized to access the document\n"
- "requested. Either you supplied the wrong\n"
- "credentials (e.g., bad password), or your\n"
- "browser doesn't understand how to supply\n"
- "the credentials required.<P>\n", r);
+ rvputs_canned_msg(r, "This server could not verify that you\n"
+ "are authorized to access the document\n"
+ "requested. Either you supplied the wrong\n"
+ "credentials (e.g., bad password), or your\n"
+ "browser doesn't understand how to supply\n"
+ "the credentials required.<P>\n", NULL);
break;
case HTTP_BAD_REQUEST:
- ap_rputs("Your browser sent a request that "
- "this server could not understand.<P>\n", r);
+ rvputs_canned_msg(r, "Your browser sent a request that "
+ "this server could not understand.<P>\n", NULL);
if ((error_notes = apr_table_get(r->notes, "error-notes")) != NULL) {
- ap_rvputs(r, error_notes, "<P>\n", NULL);
+ rvputs_canned_msg(r, error_notes, "<P>\n", NULL);
}
break;
case HTTP_FORBIDDEN:
- ap_rvputs(r, "You don't have permission to access ",
- ap_escape_html(r->pool, r->uri),
- "\non this server.<P>\n", NULL);
+ rvputs_canned_msg(r, "You don't have permission to access ",
+ ap_escape_html(r->pool, r->uri),
+ "\non this server.<P>\n", NULL);
break;
case HTTP_NOT_FOUND:
- ap_rvputs(r, "The requested URL ",
- ap_escape_html(r->pool, r->uri),
- " was not found on this server.<P>\n", NULL);
+ rvputs_canned_msg(r, "The requested URL ",
+ ap_escape_html(r->pool, r->uri),
+ " was not found on this server.<P>\n", NULL);
break;
case HTTP_METHOD_NOT_ALLOWED:
- ap_rvputs(r, "The requested method ", r->method,
- " is not allowed "
- "for the URL ", ap_escape_html(r->pool, r->uri),
- ".<P>\n", NULL);
+ rvputs_canned_msg(r, "The requested method ", r->method,
+ " is not allowed "
+ "for the URL ", ap_escape_html(r->pool, r->uri),
+ ".<P>\n", NULL);
break;
case HTTP_NOT_ACCEPTABLE:
- ap_rvputs(r,
- "An appropriate representation of the "
- "requested resource ",
- ap_escape_html(r->pool, r->uri),
- " could not be found on this server.<P>\n", NULL);
+ rvputs_canned_msg(r,
+ "An appropriate representation of the "
+ "requested resource ",
+ ap_escape_html(r->pool, r->uri),
+ " could not be found on this server.<P>\n", NULL);
/* fall through */
case HTTP_MULTIPLE_CHOICES:
{
const char *list;
if ((list = apr_table_get(r->notes, "variant-list")))
- ap_rputs(list, r);
+ rvputs_canned_msg(r, list, NULL);
}
break;
case HTTP_LENGTH_REQUIRED:
- ap_rvputs(r, "A request of the requested method ", r->method,
- " requires a valid Content-length.<P>\n", NULL);
+ rvputs_canned_msg(r, "A request of the requested method ", r->method,
+ " requires a valid Content-length.<P>\n", NULL);
if ((error_notes = apr_table_get(r->notes, "error-notes")) != NULL) {
- ap_rvputs(r, error_notes, "<P>\n", NULL);
+ rvputs_canned_msg(r, error_notes, "<P>\n", NULL);
}
break;
case HTTP_PRECONDITION_FAILED:
- ap_rvputs(r, "The precondition on the request for the URL ",
- ap_escape_html(r->pool, r->uri),
- " evaluated to false.<P>\n", NULL);
+ rvputs_canned_msg(r, "The precondition on the request for the URL ",
+ ap_escape_html(r->pool, r->uri),
+ " evaluated to false.<P>\n", NULL);
break;
case HTTP_NOT_IMPLEMENTED:
- ap_rvputs(r, ap_escape_html(r->pool, r->method), " to ",
- ap_escape_html(r->pool, r->uri),
- " not supported.<P>\n", NULL);
+ rvputs_canned_msg(r, ap_escape_html(r->pool, r->method), " to ",
+ ap_escape_html(r->pool, r->uri),
+ " not supported.<P>\n", NULL);
if ((error_notes = apr_table_get(r->notes, "error-notes")) != NULL) {
- ap_rvputs(r, error_notes, "<P>\n", NULL);
+ rvputs_canned_msg(r, error_notes, "<P>\n", NULL);
}
break;
case HTTP_BAD_GATEWAY:
- ap_rputs("The proxy server received an invalid" CRLF
- "response from an upstream server.<P>" CRLF, r);
+ rvputs_canned_msg(r, "The proxy server received an invalid" CRLF
+ "response from an upstream server.<P>" CRLF, NULL);
if ((error_notes = apr_table_get(r->notes, "error-notes")) != NULL) {
- ap_rvputs(r, error_notes, "<P>\n", NULL);
+ rvputs_canned_msg(r, error_notes, "<P>\n", NULL);
}
break;
case HTTP_VARIANT_ALSO_VARIES:
- ap_rvputs(r, "A variant for the requested resource\n<PRE>\n",
- ap_escape_html(r->pool, r->uri),
- "\n</PRE>\nis itself a negotiable resource. "
- "This indicates a configuration error.<P>\n", NULL);
+ rvputs_canned_msg(r, "A variant for the requested resource\n<PRE>\n",
+ ap_escape_html(r->pool, r->uri),
+ "\n</PRE>\nis itself a negotiable resource. "
+ "This indicates a configuration error.<P>\n", NULL);
break;
case HTTP_REQUEST_TIME_OUT:
- ap_rputs("I'm tired of waiting for your request.\n", r);
+ rvputs_canned_msg(r, "I'm tired of waiting for your request.\n", NULL);
break;
case HTTP_GONE:
- ap_rvputs(r, "The requested resource<BR>",
- ap_escape_html(r->pool, r->uri),
- "<BR>\nis no longer available on this server ",
- "and there is no forwarding address.\n",
- "Please remove all references to this resource.\n",
- NULL);
+ rvputs_canned_msg(r, "The requested resource<BR>",
+ ap_escape_html(r->pool, r->uri),
+ "<BR>\nis no longer available on this server ",
+ "and there is no forwarding address.\n",
+ "Please remove all references to this resource.\n",
+ NULL);
break;
case HTTP_REQUEST_ENTITY_TOO_LARGE:
- ap_rvputs(r, "The requested resource<BR>",
- ap_escape_html(r->pool, r->uri), "<BR>\n",
- "does not allow request data with ", r->method,
- " requests, or the amount of data provided in\n",
- "the request exceeds the capacity limit.\n", NULL);
+ rvputs_canned_msg(r, "The requested resource<BR>",
+ ap_escape_html(r->pool, r->uri), "<BR>\n",
+ "does not allow request data with ", r->method,
+ " requests, or the amount of data provided in\n",
+ "the request exceeds the capacity limit.\n", NULL);
break;
case HTTP_REQUEST_URI_TOO_LARGE:
- ap_rputs("The requested URL's length exceeds the capacity\n"
- "limit for this server.<P>\n", r);
+ rvputs_canned_msg(r, "The requested URL's length exceeds the capacity\n"
+ "limit for this server.<P>\n", NULL);
if ((error_notes = apr_table_get(r->notes, "error-notes")) != NULL) {
- ap_rvputs(r, error_notes, "<P>\n", NULL);
+ rvputs_canned_msg(r, error_notes, "<P>\n", NULL);
}
break;
case HTTP_UNSUPPORTED_MEDIA_TYPE:
- ap_rputs("The supplied request data is not in a format\n"
- "acceptable for processing by this resource.\n", r);
+ rvputs_canned_msg(r, "The supplied request data is not in a format\n"
+ "acceptable for processing by this resource.\n", NULL);
break;
case HTTP_RANGE_NOT_SATISFIABLE:
- ap_rputs("None of the range-specifier values in the Range\n"
- "request-header field overlap the current extent\n"
- "of the selected resource.\n", r);
+ rvputs_canned_msg(r, "None of the range-specifier values in the Range\n"
+ "request-header field overlap the current extent\n"
+ "of the selected resource.\n", NULL);
break;
case HTTP_EXPECTATION_FAILED:
- ap_rvputs(r, "The expectation given in the Expect request-header"
- "\nfield could not be met by this server.<P>\n"
- "The client sent<PRE>\n Expect: ",
- apr_table_get(r->headers_in, "Expect"), "\n</PRE>\n"
- "but we only allow the 100-continue expectation.\n",
- NULL);
+ rvputs_canned_msg(r, "The expectation given in the Expect request-header"
+ "\nfield could not be met by this server.<P>\n"
+ "The client sent<PRE>\n Expect: ",
+ apr_table_get(r->headers_in, "Expect"), "\n</PRE>\n"
+ "but we only allow the 100-continue expectation.\n",
+ NULL);
break;
case HTTP_UNPROCESSABLE_ENTITY:
- ap_rputs("The server understands the media type of the\n"
- "request entity, but was unable to process the\n"
- "contained instructions.\n", r);
+ rvputs_canned_msg(r, "The server understands the media type of the\n"
+ "request entity, but was unable to process the\n"
+ "contained instructions.\n", NULL);
break;
case HTTP_LOCKED:
- ap_rputs("The requested resource is currently locked.\n"
- "The lock must be released or proper identification\n"
- "given before the method can be applied.\n", r);
+ rvputs_canned_msg(r, "The requested resource is currently locked.\n"
+ "The lock must be released or proper identification\n"
+ "given before the method can be applied.\n", NULL);
break;
case HTTP_FAILED_DEPENDENCY:
- ap_rputs("The method could not be performed on the resource\n"
- "because the requested action depended on another\n"
- "action and that other action failed.\n", r);
+ rvputs_canned_msg(r, "The method could not be performed on the resource\n"
+ "because the requested action depended on another\n"
+ "action and that other action failed.\n", NULL);
break;
case HTTP_INSUFFICIENT_STORAGE:
- ap_rputs("The method could not be performed on the resource\n"
- "because the server is unable to store the\n"
- "representation needed to successfully complete the\n"
- "request. There is insufficient free space left in\n"
- "your storage allocation.\n", r);
+ rvputs_canned_msg(r, "The method could not be performed on the resource\n"
+ "because the server is unable to store the\n"
+ "representation needed to successfully complete the\n"
+ "request. There is insufficient free space left in\n"
+ "your storage allocation.\n", NULL);
break;
case HTTP_SERVICE_UNAVAILABLE:
- ap_rputs("The server is temporarily unable to service your\n"
- "request due to maintenance downtime or capacity\n"
- "problems. Please try again later.\n", r);
+ rvputs_canned_msg(r, "The server is temporarily unable to service your\n"
+ "request due to maintenance downtime or capacity\n"
+ "problems. Please try again later.\n", NULL);
break;
case HTTP_GATEWAY_TIME_OUT:
- ap_rputs("The proxy server did not receive a timely response\n"
- "from the upstream server.\n", r);
+ rvputs_canned_msg(r, "The proxy server did not receive a timely response\n"
+ "from the upstream server.\n", NULL);
break;
case HTTP_NOT_EXTENDED:
- ap_rputs("A mandatory extension policy in the request is not\n"
- "accepted by the server for this resource.\n", r);
+ rvputs_canned_msg(r, "A mandatory extension policy in the request is not\n"
+ "accepted by the server for this resource.\n", NULL);
break;
default: /* HTTP_INTERNAL_SERVER_ERROR */
/*
@@ -2987,19 +3018,19 @@
if (((error_notes = apr_table_get(r->notes, "error-notes")) != NULL)
&& (h1 = apr_table_get(r->notes, "verbose-error-to")) != NULL
&& (strcmp(h1, "*") == 0)) {
- ap_rvputs(r, error_notes, "<P>\n", NULL);
+ rvputs_canned_msg(r, error_notes, "<P>\n", NULL);
}
else {
- ap_rvputs(r, "The server encountered an internal error or\n"
- "misconfiguration and was unable to complete\n"
- "your request.<P>\n"
- "Please contact the server administrator,\n ",
- ap_escape_html(r->pool, r->server->server_admin),
- " and inform them of the time the error occurred,\n"
- "and anything you might have done that may have\n"
- "caused the error.<P>\n"
- "More information about this error may be available\n"
- "in the server error log.<P>\n", NULL);
+ rvputs_canned_msg(r, "The server encountered an internal error or\n"
+ "misconfiguration and was unable to complete\n"
+ "your request.<P>\n"
+ "Please contact the server administrator,\n ",
+ ap_escape_html(r->pool, r->server->server_admin),
+ " and inform them of the time the error occurred,\n"
+ "and anything you might have done that may have\n"
+ "caused the error.<P>\n"
+ "More information about this error may be available\n"
+ "in the server error log.<P>\n", NULL);
}
/*
* It would be nice to give the user the information they need to
@@ -3011,20 +3042,20 @@
* can figure out a way to remove the pathname, leave this commented.
*
* if ((error_notes = apr_table_get(r->notes, "error-notes")) != NULL) {
- * ap_rvputs(r, error_notes, "<P>\n", NULL);
+ * rvputs_canned_msg(r, error_notes, "<P>\n", NULL);
* }
*/
break;
}
if (recursive_error) {
- ap_rvputs(r, "<P>Additionally, a ",
- status_lines[ap_index_of_response(recursive_error)],
- "\nerror was encountered while trying to use an "
- "ErrorDocument to handle the request.\n", NULL);
+ rvputs_canned_msg(r, "<P>Additionally, a ",
+ status_lines[ap_index_of_response(recursive_error)],
+ "\nerror was encountered while trying to use an "
+ "ErrorDocument to handle the request.\n", NULL);
}
- ap_rputs(ap_psignature("<HR>\n", r), r);
- ap_rputs("</BODY></HTML>\n", r);
+ rvputs_canned_msg(r, ap_psignature("<HR>\n", r), NULL);
+ rvputs_canned_msg(r, "</BODY></HTML>\n", NULL);
}
ap_finalize_request_protocol(r);
ap_rflush(r);
--
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
http://www.geocities.com/SiliconValley/Park/9289/
Born in Roswell... married an alien...
Re: [PATCH] filtering and canned error responses
Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
rbb@covalent.net wrote:
>
> On Tue, 5 Sep 2000, Rodent of Unusual Size wrote:
>
> > Then perhaps we're not using the term 'tags' the same way. I'm
> > talking about any sort of markup at all. Consider a filter that
> > tries to convert HTML to plaintext, or WML, for transmission to
> > a smallscreen or dumb device.
>
> No, we aren't talking about the same thing. I was specifically
> talking about SSI type tags. Tags that must be converted to
> something else on the server, or they make no sense.
Then we are talking about the same thing after all. See my
example above.
--
#ken P-)}
Ken Coar <http://Golux.Com/coar/>
Apache Software Foundation <http://www.apache.org/>
"Apache Server for Dummies" <http://Apache-Server.Com/>
"Apache Server Unleashed" <http://ApacheUnleashed.Com/>
Re: [PATCH] filtering and canned error responses
Posted by rb...@covalent.net.
On Tue, 5 Sep 2000, Rodent of Unusual Size wrote:
> rbb@covalent.net wrote:
> >
> > Huh? I just looked through ap_send_error_response again. We don't
> > generate any errors with tags that a filter would replace.
>
> Then perhaps we're not using the term 'tags' the same way. I'm
> talking about any sort of markup at all. Consider a filter that
> tries to convert HTML to plaintext, or WML, for transmission to
> a smallscreen or dumb device.
No, we aren't talking about the same thing. I was specifically talking
about SSI type tags. Tags that must be converted to something else on the
server, or they make no sense.
Ryan
_______________________________________________________________________________
Ryan Bloom rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------
Re: [PATCH] filtering and canned error responses
Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
rbb@covalent.net wrote:
>
> Huh? I just looked through ap_send_error_response again. We don't
> generate any errors with tags that a filter would replace.
Then perhaps we're not using the term 'tags' the same way. I'm
talking about any sort of markup at all. Consider a filter that
tries to convert HTML to plaintext, or WML, for transmission to
a smallscreen or dumb device.
--
#ken P-)}
Ken Coar <http://Golux.Com/coar/>
Apache Software Foundation <http://www.apache.org/>
"Apache Server for Dummies" <http://Apache-Server.Com/>
"Apache Server Unleashed" <http://ApacheUnleashed.Com/>
Re: [PATCH] filtering and canned error responses
Posted by rb...@covalent.net.
On Sat, 2 Sep 2000, Rodent of Unusual Size wrote:
> rbb@covalent.net wrote:
> >
> > Tags are not an issue in this case, because we all agree that any
> > errors Apache generates won't have tags.
>
> No, we don't all agree. I'm perfectly content with the
> current HTML of which our canned messages consist, and I would
> resist changing them to text/plain.
Huh? I just looked through ap_send_error_response again. We don't
generate any errors with tags that a filter would replace. We can't,
because we can't garuantee that the correct module is in the server. This
has nothing to do with replacing MIME type of the error response, just the
content. It is impossible (AFAICS) for us to include tags in our generic
error strings that are replaced on the server side.
Ryan
_______________________________________________________________________________
Ryan Bloom rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------
Re: [PATCH] filtering and canned error responses
Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
rbb@covalent.net wrote:
>
> Tags are not an issue in this case, because we all agree that any
> errors Apache generates won't have tags.
No, we don't all agree. I'm perfectly content with the
current HTML of which our canned messages consist, and I would
resist changing them to text/plain.
--
#ken P-)}
Ken Coar <http://Golux.Com/coar/>
Apache Software Foundation <http://www.apache.org/>
"Apache Server for Dummies" <http://Apache-Server.Com/>
"Apache Server Unleashed" <http://ApacheUnleashed.Com/>
Re: [PATCH] filtering and canned error responses
Posted by Tony Finch <do...@dotat.at>.
"William A. Rowe, Jr." <wr...@rowe-clan.net> wrote:
>Tony Finch <do...@dotat.at> wrote:
>> Jeff Trawick <tr...@bellsouth.net> wrote:
>> >
>> >When a redirection does not occur (no ErrorDocument directive for the
>> >error or an ErrorDocument directive which specifies the error message
>> >directly), how do we avoid a filter using the wrong configuration
>> >directives?
>>
>> My suggestion is that this *would* be implemented by a redirection,
>> thus avoiding the problem entirely.
>
>Actually, it sounds like a text/plain provider of constant string /
>status result. Which charset? Guess that would be the default system
>language.
Yes.
>But it's an internal redirect, it should -not- be handled by the
>client (we don't want spiders, etc, wasting multiple requests.)
Yes, of course, just like any other internal redirect.
Tony.
--
en oeccget g mtcaa f.a.n.finch
v spdlkishrhtewe y dot@dotat.at
eatp o v eiti i d. fanf@covalent.net
RE: [PATCH] filtering and canned error responses
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
> From: Tony Finch [mailto:dot@dotat.at]
> Sent: Friday, September 08, 2000 5:12 PM
> To: new-httpd@apache.org
> Subject: Re: [PATCH] filtering and canned error responses
>
> Jeff Trawick <tr...@bellsouth.net> wrote:
> >
> >When a redirection does not occur (no ErrorDocument directive for the
> >error or an ErrorDocument directive which specifies the error message
> >directly), how do we avoid a filter using the wrong configuration
> >directives?
>
> My suggestion is that this *would* be implemented by a redirection,
> thus avoiding the problem entirely.
Actually, it sounds like a text/plain provider of constant string /
status result. Which charset? Guess that would be the default system
language. But it's an internal redirect, it should -not- be handled
by the client (we don't want spiders, etc, wasting multiple requests.)
Re: [PATCH] filtering and canned error responses
Posted by Tony Finch <do...@dotat.at>.
Jeff Trawick <tr...@bellsouth.net> wrote:
>
>When a redirection does not occur (no ErrorDocument directive for the
>error or an ErrorDocument directive which specifies the error message
>directly), how do we avoid a filter using the wrong configuration
>directives?
My suggestion is that this *would* be implemented by a redirection,
thus avoiding the problem entirely.
Tony.
--
en oeccget g mtcaa f.a.n.finch
v spdlkishrhtewe y dot@dotat.at
eatp o v eiti i d. fanf@covalent.net
Re: [PATCH] filtering and canned error responses
Posted by Jeff Trawick <tr...@bellsouth.net>.
rbb@covalent.net writes:
> > I disagree completely with the premise that all filters act on tags in
> > a fashion similar to mod_include. That is a debilitating requirement.
> > Certain filters can work that way and certain ones can't. It is
> > better to disallow filtering on the error strings than to require that
> > filters sanity-check their input data (not all filters can even do
> > that). (Besides, the less code between an error message and the
> > network the better... Sending an error message should be a relatively
> > simple.)
>
> But who's to say that we don't want all filters acting on those errors. I
> see a few cases, filters that add data to all output, filters that add
> data on tags, and filters that modify some characteristic of the
> data.
>
> Tags are not an issue in this case, because we all agree that any
> errors Apache generates won't have tags.
What is a tag? That is for the filter to decide (if indeed the
filter's processing is tag-based).
> Adding data to all output (I'm thinking header and trailer documents that
> identify the site, or add a logo, or something like that) may want to be
> used on error documents.
>
> Filters that modify the data (I'm thinking charset or automatic langauge
> translation) are very useful, especially on error pages. These aren't
> connection filters, they are content filters.
True. That is an area where we have breakage now.
Suppose the requested object is /cgi-bin/1047/gobble.
mod_charset_lite has been told to translate text/* output in
/cgi-bin/1047/ from IBM1047 to 8859-1. Apache determines that there
is no such URI and generates an error message. That error message is
then translated by mod_charset_lite according to the information that
was available prior to when we realized that /cgi-bin/1047/gobble
didn't exist. The result is a meaningless translation and an
unreadable canned error message.
When a redirection occurs (i.e., the administrator has specified
ErrorDocument 404 /errors/404.html), then modules will be given
information about /errors/404.html and the set of filters will be
built appropriately and the configuration used by the filters will be
the appropriate configuration for /errors/404.html (not the
configuration for /cgi-bin/1047/gobble).
When a redirection does not occur (no ErrorDocument directive for the
error or an ErrorDocument directive which specifies the error message
directly), how do we avoid a filter using the wrong configuration
directives? (Not that there are any configuration directives for such
a canned error messages.)
Recap:
redirection:
magic happens; modules know what is going on
no redirection:
potential GIGO, 'cause filters don't know what to do
Some filters only act on tags, and if they aren't present they'll
pass the data on through with no breakage.
Some filters do not act on tags; all they know to do is to perform
a certain transformation on every byte of input.
Some problems:
1) If we're on an EBCDIC machine, how do we translate canned error
messages (i.e., no ErrorDocument-proscribed redirection) from the
code page of the source code to 8859-1?
This is similar to another problem -- translating HTTP header
fields and chunk headers/trailers from the code page of the source
code to 8859-1, so it can be solved in the same way (some
indication in the bucket of what is going on?).
2) What if we absolutely must send canned error messages through
certain required filters? One example is language translation,
which you mentioned above. Another example is an HTML->WML
translator (not that I know how a module would know when to install
that filter :) ).
I don't know. Mandatory redirection isn't cool because you still
need the simple fallback method of generating the message when the
redirection fails.
>
> Of the three types I can see for filters, one isn't an issue, and the
> other two are may want to filter the error doc.
>
> > If the administrator wants filter processing on an error document she
> > can use a redirect, so there is no big loss here.
>
> But why bother with this. What is the problem we are trying to solve with
> this? To me, it seems very straightforward that the error docs are put
> into a bucket brigade with an EOS, because know that the doc is done, and
> we send it down the filter stack. This doesn't try to avoid the filter
> logic we already have and it should work. Where is the issue?
>
> > I'm not sure I understand "canned errors generated by mistakes in
> > SSIs." Are you talking about a failed subrequest?
>
> Take a look at mod_include. We return the string "[an error occurred
> while processing this directive]" whenever we encounter an error in
> processing an SSI tag. We don't want to send those out without filtering
> them. Also, how does this affect sub-requests? If I have data that is
> being buffered by some filter, and a filter higher-up sends a canned-error
> response, won't the output be all messed up, because it won't wait for the
> data sitting in the lower filter?
The mod_include case is different than the cases affected by my patch.
In the mod_include case you refer to, we are delivering the URI which
was requested. There may be the occasional mod_include error message,
but any filters in the chain after mod_include are processing the
output that they expect (according to their hooks which were called
prior to the content handler).
--
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
http://www.geocities.com/SiliconValley/Park/9289/
Born in Roswell... married an alien...
Re: [PATCH] filtering and canned error responses
Posted by rb...@covalent.net.
> I disagree completely with the premise that all filters act on tags in
> a fashion similar to mod_include. That is a debilitating requirement.
> Certain filters can work that way and certain ones can't. It is
> better to disallow filtering on the error strings than to require that
> filters sanity-check their input data (not all filters can even do
> that). (Besides, the less code between an error message and the
> network the better... Sending an error message should be a relatively
> simple.)
But who's to say that we don't want all filters acting on those errors. I
see a few cases, filters that add data to all output, filters that add
data on tags, and filters that modify some characteristic of the
data.
Tags are not an issue in this case, because we all agree that any
errors Apache generates won't have tags.
Adding data to all output (I'm thinking header and trailer documents that
identify the site, or add a logo, or something like that) may want to be
used on error documents.
Filters that modify the data (I'm thinking charset or automatic langauge
translation) are very useful, especially on error pages. These aren't
connection filters, they are content filters.
Of the three types I can see for filters, one isn't an issue, and the
other two are may want to filter the error doc.
> If the administrator wants filter processing on an error document she
> can use a redirect, so there is no big loss here.
But why bother with this. What is the problem we are trying to solve with
this? To me, it seems very straightforward that the error docs are put
into a bucket brigade with an EOS, because know that the doc is done, and
we send it down the filter stack. This doesn't try to avoid the filter
logic we already have and it should work. Where is the issue?
> I'm not sure I understand "canned errors generated by mistakes in
> SSIs." Are you talking about a failed subrequest?
Take a look at mod_include. We return the string "[an error occurred
while processing this directive]" whenever we encounter an error in
processing an SSI tag. We don't want to send those out without filtering
them. Also, how does this affect sub-requests? If I have data that is
being buffered by some filter, and a filter higher-up sends a canned-error
response, won't the output be all messed up, because it won't wait for the
data sitting in the lower filter?
Ryan
_______________________________________________________________________________
Ryan Bloom rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------
Re: [PATCH] filtering and canned error responses
Posted by Jeff Trawick <tr...@bellsouth.net>.
rbb@covalent.net writes:
> I disagree with this. Sorry for not speaking up before. I have been very
> busy, and I have had many other things on my mind. All text needs to be
> passed through all filters. Think about the canned errors generated by
> mistakes in SSIs. Those are part of the document, and should be processed
> by the rest of the filters in the chain. None of our canned errors should
> cause any filter to modify data, because they don't have any tags in them,
> but that doesn't mean that somebody who write mod_mumblefoo, won't want
> their filter to put the current date in the error using SSI tags.
I disagree completely with the premise that all filters act on tags in
a fashion similar to mod_include. That is a debilitating requirement.
Certain filters can work that way and certain ones can't. It is
better to disallow filtering on the error strings than to require that
filters sanity-check their input data (not all filters can even do
that). (Besides, the less code between an error message and the
network the better... Sending an error message should be a relatively
simple.)
If the administrator wants filter processing on an error document she
can use a redirect, so there is no big loss here.
I'm not sure I understand "canned errors generated by mistakes in
SSIs." Are you talking about a failed subrequest?
--
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
http://www.geocities.com/SiliconValley/Park/9289/
Born in Roswell... married an alien...
Re: [PATCH] filtering and canned error responses
Posted by rb...@covalent.net.
I disagree with this. Sorry for not speaking up before. I have been very
busy, and I have had many other things on my mind. All text needs to be
passed through all filters. Think about the canned errors generated by
mistakes in SSIs. Those are part of the document, and should be processed
by the rest of the filters in the chain. None of our canned errors should
cause any filter to modify data, because they don't have any tags in them,
but that doesn't mean that somebody who write mod_mumblefoo, won't want
their filter to put the current date in the error using SSI tags.
Ryan
On 1 Sep 2000, Jeff Trawick wrote:
> Jeff Trawick <tr...@bellsouth.net> writes:
>
> > For the purposes of this discussion, "canned error responses" are
> > those strings generated by ap_send_error_response().
> >
> > Currently, there is non-sensical filtering done on this text. Normal
> > request processing triggered modules to set up filtering appropriate
> > to the original request. But the original request failed for some
> > reason and now we're creating an error message. Should content
> > filters see this message?
> >
> > I think that these messages should be passed to the connection
> > filters, skipping the content filters.
> >
> > An example problem:
> >
> > Tell Apache that pages in root/1047 are in character set IBM-1047.
> > Ask for non-existent file root/1047/index.html. mod_charset_lite sets
> > up a translation filter. The only content is the "404 Not Found"
> > document, which is in iso-8859-1, but mod_charset_lite translates it
> > as if it were IBM-1047, resulting in garbage.
> >
> > mod_charset_lite might be able to perform extra checks to detect this
> > situation, but I'm thinking that in general all content filters could
> > run into non-sensical (or at least unnecessary) processing.
> >
> > Comments?
> >
> > --
> > Jeff Trawick | trawick@ibm.net | PGP public key at web site:
> > http://www.geocities.com/SiliconValley/Park/9289/
> > Born in Roswell... married an alien...
> >
>
> This patch implements the suggestion described above... It is
> intended to work for the messages hard-coded in apache as well as
> ErrorDocument literal strings (e.g., `ErrorDocument 404 "You're such a
> loser"').
>
> Any concerns to discuss?
>
> It seems likely that rvputs_canned_msg() will eventually indicate in
> the buckets it creates that the strings are in the implementation
> character set. Such a flag could be used to trigger translation of
> these error strings as well as chunk headers/trailers and headers.
> Unclear...
>
> Index: main/http_protocol.c
> ===================================================================
> RCS file: /home/cvspublic/apache-2.0/src/main/http_protocol.c,v
> retrieving revision 1.118
> diff -u -r1.118 http_protocol.c
> --- main/http_protocol.c 2000/08/30 01:09:03 1.118
> +++ main/http_protocol.c 2000/09/01 17:38:26
> @@ -2624,6 +2624,37 @@
> return written;
> }
>
> +static int rvputs_canned_msg(request_rec *r, ...)
> +{
> + ap_bucket_brigade *bb = NULL;
> + apr_ssize_t written;
> + va_list va;
> +
> + if (r->connection->aborted)
> + return EOF;
> + bb = ap_brigade_create(r->pool);
> + va_start(va, r);
> + written = ap_brigade_vputstrs(bb, va);
> + va_end(va);
> + if (written != 0) {
> + /* This is canned text which should not be processed by content
> + * filters, so find the first connection filter and hand it
> + * the brigade.
> + */
> + ap_filter_t *f = r->filters;
> +
> + /* XXX: check should be "ftype != AP_FTYPE_CONNECTION", but we're
> + * playing tricks currently with the types of chunk_filter and
> + * core_filter
> + */
> + while (f->ftype == AP_FTYPE_CONTENT) {
> + f = f->next;
> + }
> + ap_pass_brigade(f, bb);
> + }
> + return written;
> +}
> +
> API_EXPORT(int) ap_rflush(request_rec *r)
> {
> /* ### this is probably incorrect, but we have no mechanism for telling
> @@ -2762,7 +2793,7 @@
> * the original error and output that as well.
> */
> if (custom_response[0] == '\"') {
> - ap_rputs(custom_response + 1, r);
> + rvputs_canned_msg(r, custom_response + 1, NULL);
> ap_finalize_request_protocol(r);
> ap_rflush(r);
> return;
> @@ -2794,187 +2825,187 @@
> /* folks decided they didn't want the error code in the H1 text */
> h1 = &title[4];
>
> - ap_rvputs(r,
> - DOCTYPE_HTML_2_0
> - "<HTML><HEAD>\n<TITLE>", title,
> - "</TITLE>\n</HEAD><BODY>\n<H1>", h1, "</H1>\n",
> - NULL);
> + rvputs_canned_msg(r,
> + DOCTYPE_HTML_2_0
> + "<HTML><HEAD>\n<TITLE>", title,
> + "</TITLE>\n</HEAD><BODY>\n<H1>", h1, "</H1>\n",
> + NULL);
>
> switch (status) {
> case HTTP_MOVED_PERMANENTLY:
> case HTTP_MOVED_TEMPORARILY:
> case HTTP_TEMPORARY_REDIRECT:
> - ap_rvputs(r, "The document has moved <A HREF=\"",
> - ap_escape_html(r->pool, location), "\">here</A>.<P>\n",
> - NULL);
> + rvputs_canned_msg(r, "The document has moved <A HREF=\"",
> + ap_escape_html(r->pool, location), "\">here</A>.<P>\n",
> + NULL);
> break;
> case HTTP_SEE_OTHER:
> - ap_rvputs(r, "The answer to your request is located <A HREF=\"",
> - ap_escape_html(r->pool, location), "\">here</A>.<P>\n",
> - NULL);
> + rvputs_canned_msg(r, "The answer to your request is located <A HREF=\"",
> + ap_escape_html(r->pool, location), "\">here</A>.<P>\n",
> + NULL);
> break;
> case HTTP_USE_PROXY:
> - ap_rvputs(r, "This resource is only accessible "
> - "through the proxy\n",
> - ap_escape_html(r->pool, location),
> - "<BR>\nYou will need to ",
> - "configure your client to use that proxy.<P>\n", NULL);
> + rvputs_canned_msg(r, "This resource is only accessible "
> + "through the proxy\n",
> + ap_escape_html(r->pool, location),
> + "<BR>\nYou will need to ",
> + "configure your client to use that proxy.<P>\n", NULL);
> break;
> case HTTP_PROXY_AUTHENTICATION_REQUIRED:
> case HTTP_UNAUTHORIZED:
> - ap_rputs("This server could not verify that you\n"
> - "are authorized to access the document\n"
> - "requested. Either you supplied the wrong\n"
> - "credentials (e.g., bad password), or your\n"
> - "browser doesn't understand how to supply\n"
> - "the credentials required.<P>\n", r);
> + rvputs_canned_msg(r, "This server could not verify that you\n"
> + "are authorized to access the document\n"
> + "requested. Either you supplied the wrong\n"
> + "credentials (e.g., bad password), or your\n"
> + "browser doesn't understand how to supply\n"
> + "the credentials required.<P>\n", NULL);
> break;
> case HTTP_BAD_REQUEST:
> - ap_rputs("Your browser sent a request that "
> - "this server could not understand.<P>\n", r);
> + rvputs_canned_msg(r, "Your browser sent a request that "
> + "this server could not understand.<P>\n", NULL);
> if ((error_notes = apr_table_get(r->notes, "error-notes")) != NULL) {
> - ap_rvputs(r, error_notes, "<P>\n", NULL);
> + rvputs_canned_msg(r, error_notes, "<P>\n", NULL);
> }
> break;
> case HTTP_FORBIDDEN:
> - ap_rvputs(r, "You don't have permission to access ",
> - ap_escape_html(r->pool, r->uri),
> - "\non this server.<P>\n", NULL);
> + rvputs_canned_msg(r, "You don't have permission to access ",
> + ap_escape_html(r->pool, r->uri),
> + "\non this server.<P>\n", NULL);
> break;
> case HTTP_NOT_FOUND:
> - ap_rvputs(r, "The requested URL ",
> - ap_escape_html(r->pool, r->uri),
> - " was not found on this server.<P>\n", NULL);
> + rvputs_canned_msg(r, "The requested URL ",
> + ap_escape_html(r->pool, r->uri),
> + " was not found on this server.<P>\n", NULL);
> break;
> case HTTP_METHOD_NOT_ALLOWED:
> - ap_rvputs(r, "The requested method ", r->method,
> - " is not allowed "
> - "for the URL ", ap_escape_html(r->pool, r->uri),
> - ".<P>\n", NULL);
> + rvputs_canned_msg(r, "The requested method ", r->method,
> + " is not allowed "
> + "for the URL ", ap_escape_html(r->pool, r->uri),
> + ".<P>\n", NULL);
> break;
> case HTTP_NOT_ACCEPTABLE:
> - ap_rvputs(r,
> - "An appropriate representation of the "
> - "requested resource ",
> - ap_escape_html(r->pool, r->uri),
> - " could not be found on this server.<P>\n", NULL);
> + rvputs_canned_msg(r,
> + "An appropriate representation of the "
> + "requested resource ",
> + ap_escape_html(r->pool, r->uri),
> + " could not be found on this server.<P>\n", NULL);
> /* fall through */
> case HTTP_MULTIPLE_CHOICES:
> {
> const char *list;
> if ((list = apr_table_get(r->notes, "variant-list")))
> - ap_rputs(list, r);
> + rvputs_canned_msg(r, list, NULL);
> }
> break;
> case HTTP_LENGTH_REQUIRED:
> - ap_rvputs(r, "A request of the requested method ", r->method,
> - " requires a valid Content-length.<P>\n", NULL);
> + rvputs_canned_msg(r, "A request of the requested method ", r->method,
> + " requires a valid Content-length.<P>\n", NULL);
> if ((error_notes = apr_table_get(r->notes, "error-notes")) != NULL) {
> - ap_rvputs(r, error_notes, "<P>\n", NULL);
> + rvputs_canned_msg(r, error_notes, "<P>\n", NULL);
> }
> break;
> case HTTP_PRECONDITION_FAILED:
> - ap_rvputs(r, "The precondition on the request for the URL ",
> - ap_escape_html(r->pool, r->uri),
> - " evaluated to false.<P>\n", NULL);
> + rvputs_canned_msg(r, "The precondition on the request for the URL ",
> + ap_escape_html(r->pool, r->uri),
> + " evaluated to false.<P>\n", NULL);
> break;
> case HTTP_NOT_IMPLEMENTED:
> - ap_rvputs(r, ap_escape_html(r->pool, r->method), " to ",
> - ap_escape_html(r->pool, r->uri),
> - " not supported.<P>\n", NULL);
> + rvputs_canned_msg(r, ap_escape_html(r->pool, r->method), " to ",
> + ap_escape_html(r->pool, r->uri),
> + " not supported.<P>\n", NULL);
> if ((error_notes = apr_table_get(r->notes, "error-notes")) != NULL) {
> - ap_rvputs(r, error_notes, "<P>\n", NULL);
> + rvputs_canned_msg(r, error_notes, "<P>\n", NULL);
> }
> break;
> case HTTP_BAD_GATEWAY:
> - ap_rputs("The proxy server received an invalid" CRLF
> - "response from an upstream server.<P>" CRLF, r);
> + rvputs_canned_msg(r, "The proxy server received an invalid" CRLF
> + "response from an upstream server.<P>" CRLF, NULL);
> if ((error_notes = apr_table_get(r->notes, "error-notes")) != NULL) {
> - ap_rvputs(r, error_notes, "<P>\n", NULL);
> + rvputs_canned_msg(r, error_notes, "<P>\n", NULL);
> }
> break;
> case HTTP_VARIANT_ALSO_VARIES:
> - ap_rvputs(r, "A variant for the requested resource\n<PRE>\n",
> - ap_escape_html(r->pool, r->uri),
> - "\n</PRE>\nis itself a negotiable resource. "
> - "This indicates a configuration error.<P>\n", NULL);
> + rvputs_canned_msg(r, "A variant for the requested resource\n<PRE>\n",
> + ap_escape_html(r->pool, r->uri),
> + "\n</PRE>\nis itself a negotiable resource. "
> + "This indicates a configuration error.<P>\n", NULL);
> break;
> case HTTP_REQUEST_TIME_OUT:
> - ap_rputs("I'm tired of waiting for your request.\n", r);
> + rvputs_canned_msg(r, "I'm tired of waiting for your request.\n", NULL);
> break;
> case HTTP_GONE:
> - ap_rvputs(r, "The requested resource<BR>",
> - ap_escape_html(r->pool, r->uri),
> - "<BR>\nis no longer available on this server ",
> - "and there is no forwarding address.\n",
> - "Please remove all references to this resource.\n",
> - NULL);
> + rvputs_canned_msg(r, "The requested resource<BR>",
> + ap_escape_html(r->pool, r->uri),
> + "<BR>\nis no longer available on this server ",
> + "and there is no forwarding address.\n",
> + "Please remove all references to this resource.\n",
> + NULL);
> break;
> case HTTP_REQUEST_ENTITY_TOO_LARGE:
> - ap_rvputs(r, "The requested resource<BR>",
> - ap_escape_html(r->pool, r->uri), "<BR>\n",
> - "does not allow request data with ", r->method,
> - " requests, or the amount of data provided in\n",
> - "the request exceeds the capacity limit.\n", NULL);
> + rvputs_canned_msg(r, "The requested resource<BR>",
> + ap_escape_html(r->pool, r->uri), "<BR>\n",
> + "does not allow request data with ", r->method,
> + " requests, or the amount of data provided in\n",
> + "the request exceeds the capacity limit.\n", NULL);
> break;
> case HTTP_REQUEST_URI_TOO_LARGE:
> - ap_rputs("The requested URL's length exceeds the capacity\n"
> - "limit for this server.<P>\n", r);
> + rvputs_canned_msg(r, "The requested URL's length exceeds the capacity\n"
> + "limit for this server.<P>\n", NULL);
> if ((error_notes = apr_table_get(r->notes, "error-notes")) != NULL) {
> - ap_rvputs(r, error_notes, "<P>\n", NULL);
> + rvputs_canned_msg(r, error_notes, "<P>\n", NULL);
> }
> break;
> case HTTP_UNSUPPORTED_MEDIA_TYPE:
> - ap_rputs("The supplied request data is not in a format\n"
> - "acceptable for processing by this resource.\n", r);
> + rvputs_canned_msg(r, "The supplied request data is not in a format\n"
> + "acceptable for processing by this resource.\n", NULL);
> break;
> case HTTP_RANGE_NOT_SATISFIABLE:
> - ap_rputs("None of the range-specifier values in the Range\n"
> - "request-header field overlap the current extent\n"
> - "of the selected resource.\n", r);
> + rvputs_canned_msg(r, "None of the range-specifier values in the Range\n"
> + "request-header field overlap the current extent\n"
> + "of the selected resource.\n", NULL);
> break;
> case HTTP_EXPECTATION_FAILED:
> - ap_rvputs(r, "The expectation given in the Expect request-header"
> - "\nfield could not be met by this server.<P>\n"
> - "The client sent<PRE>\n Expect: ",
> - apr_table_get(r->headers_in, "Expect"), "\n</PRE>\n"
> - "but we only allow the 100-continue expectation.\n",
> - NULL);
> + rvputs_canned_msg(r, "The expectation given in the Expect request-header"
> + "\nfield could not be met by this server.<P>\n"
> + "The client sent<PRE>\n Expect: ",
> + apr_table_get(r->headers_in, "Expect"), "\n</PRE>\n"
> + "but we only allow the 100-continue expectation.\n",
> + NULL);
> break;
> case HTTP_UNPROCESSABLE_ENTITY:
> - ap_rputs("The server understands the media type of the\n"
> - "request entity, but was unable to process the\n"
> - "contained instructions.\n", r);
> + rvputs_canned_msg(r, "The server understands the media type of the\n"
> + "request entity, but was unable to process the\n"
> + "contained instructions.\n", NULL);
> break;
> case HTTP_LOCKED:
> - ap_rputs("The requested resource is currently locked.\n"
> - "The lock must be released or proper identification\n"
> - "given before the method can be applied.\n", r);
> + rvputs_canned_msg(r, "The requested resource is currently locked.\n"
> + "The lock must be released or proper identification\n"
> + "given before the method can be applied.\n", NULL);
> break;
> case HTTP_FAILED_DEPENDENCY:
> - ap_rputs("The method could not be performed on the resource\n"
> - "because the requested action depended on another\n"
> - "action and that other action failed.\n", r);
> + rvputs_canned_msg(r, "The method could not be performed on the resource\n"
> + "because the requested action depended on another\n"
> + "action and that other action failed.\n", NULL);
> break;
> case HTTP_INSUFFICIENT_STORAGE:
> - ap_rputs("The method could not be performed on the resource\n"
> - "because the server is unable to store the\n"
> - "representation needed to successfully complete the\n"
> - "request. There is insufficient free space left in\n"
> - "your storage allocation.\n", r);
> + rvputs_canned_msg(r, "The method could not be performed on the resource\n"
> + "because the server is unable to store the\n"
> + "representation needed to successfully complete the\n"
> + "request. There is insufficient free space left in\n"
> + "your storage allocation.\n", NULL);
> break;
> case HTTP_SERVICE_UNAVAILABLE:
> - ap_rputs("The server is temporarily unable to service your\n"
> - "request due to maintenance downtime or capacity\n"
> - "problems. Please try again later.\n", r);
> + rvputs_canned_msg(r, "The server is temporarily unable to service your\n"
> + "request due to maintenance downtime or capacity\n"
> + "problems. Please try again later.\n", NULL);
> break;
> case HTTP_GATEWAY_TIME_OUT:
> - ap_rputs("The proxy server did not receive a timely response\n"
> - "from the upstream server.\n", r);
> + rvputs_canned_msg(r, "The proxy server did not receive a timely response\n"
> + "from the upstream server.\n", NULL);
> break;
> case HTTP_NOT_EXTENDED:
> - ap_rputs("A mandatory extension policy in the request is not\n"
> - "accepted by the server for this resource.\n", r);
> + rvputs_canned_msg(r, "A mandatory extension policy in the request is not\n"
> + "accepted by the server for this resource.\n", NULL);
> break;
> default: /* HTTP_INTERNAL_SERVER_ERROR */
> /*
> @@ -2987,19 +3018,19 @@
> if (((error_notes = apr_table_get(r->notes, "error-notes")) != NULL)
> && (h1 = apr_table_get(r->notes, "verbose-error-to")) != NULL
> && (strcmp(h1, "*") == 0)) {
> - ap_rvputs(r, error_notes, "<P>\n", NULL);
> + rvputs_canned_msg(r, error_notes, "<P>\n", NULL);
> }
> else {
> - ap_rvputs(r, "The server encountered an internal error or\n"
> - "misconfiguration and was unable to complete\n"
> - "your request.<P>\n"
> - "Please contact the server administrator,\n ",
> - ap_escape_html(r->pool, r->server->server_admin),
> - " and inform them of the time the error occurred,\n"
> - "and anything you might have done that may have\n"
> - "caused the error.<P>\n"
> - "More information about this error may be available\n"
> - "in the server error log.<P>\n", NULL);
> + rvputs_canned_msg(r, "The server encountered an internal error or\n"
> + "misconfiguration and was unable to complete\n"
> + "your request.<P>\n"
> + "Please contact the server administrator,\n ",
> + ap_escape_html(r->pool, r->server->server_admin),
> + " and inform them of the time the error occurred,\n"
> + "and anything you might have done that may have\n"
> + "caused the error.<P>\n"
> + "More information about this error may be available\n"
> + "in the server error log.<P>\n", NULL);
> }
> /*
> * It would be nice to give the user the information they need to
> @@ -3011,20 +3042,20 @@
> * can figure out a way to remove the pathname, leave this commented.
> *
> * if ((error_notes = apr_table_get(r->notes, "error-notes")) != NULL) {
> - * ap_rvputs(r, error_notes, "<P>\n", NULL);
> + * rvputs_canned_msg(r, error_notes, "<P>\n", NULL);
> * }
> */
> break;
> }
>
> if (recursive_error) {
> - ap_rvputs(r, "<P>Additionally, a ",
> - status_lines[ap_index_of_response(recursive_error)],
> - "\nerror was encountered while trying to use an "
> - "ErrorDocument to handle the request.\n", NULL);
> + rvputs_canned_msg(r, "<P>Additionally, a ",
> + status_lines[ap_index_of_response(recursive_error)],
> + "\nerror was encountered while trying to use an "
> + "ErrorDocument to handle the request.\n", NULL);
> }
> - ap_rputs(ap_psignature("<HR>\n", r), r);
> - ap_rputs("</BODY></HTML>\n", r);
> + rvputs_canned_msg(r, ap_psignature("<HR>\n", r), NULL);
> + rvputs_canned_msg(r, "</BODY></HTML>\n", NULL);
> }
> ap_finalize_request_protocol(r);
> ap_rflush(r);
>
> --
> Jeff Trawick | trawick@ibm.net | PGP public key at web site:
> http://www.geocities.com/SiliconValley/Park/9289/
> Born in Roswell... married an alien...
>
_______________________________________________________________________________
Ryan Bloom rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------