You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@locus.apache.org on 2000/12/29 14:51:41 UTC
cvs commit: httpd-2.0/modules/experimental mod_charset_lite.c
trawick 00/12/29 05:51:40
Modified: modules/experimental mod_charset_lite.c
Log:
Recognize a downstream error as such (instead of saying simply "returning error").
Trace the apr_status_t whenever helpful.
Revision Changes Path
1.35 +23 -3 httpd-2.0/modules/experimental/mod_charset_lite.c
Index: mod_charset_lite.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_charset_lite.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- mod_charset_lite.c 2000/12/20 16:43:36 1.34
+++ mod_charset_lite.c 2000/12/29 13:51:38 1.35
@@ -108,6 +108,7 @@
EES_LIMIT, /* built-in restriction encountered */
EES_INCOMPLETE_CHAR, /* incomplete multi-byte char at end of content */
EES_BUCKET_READ,
+ EES_DOWNSTREAM, /* something bad happened in a filter below xlate */
EES_BAD_INPUT /* input data invalid */
} ees_t;
@@ -456,22 +457,34 @@
{
ap_bucket_brigade *bb;
ap_bucket *b;
+ charset_filter_ctx_t *ctx = f->ctx;
+ apr_status_t rv;
bb = ap_brigade_create(f->r->pool);
b = ap_bucket_create_transient(tmp, len);
AP_BRIGADE_INSERT_TAIL(bb, b);
- return ap_pass_brigade(f->next, bb);
+ rv = ap_pass_brigade(f->next, bb);
+ if (rv != APR_SUCCESS) {
+ ctx->ees = EES_DOWNSTREAM;
+ }
+ return rv;
}
static apr_status_t send_eos(ap_filter_t *f)
{
ap_bucket_brigade *bb;
ap_bucket *b;
+ charset_filter_ctx_t *ctx = f->ctx;
+ apr_status_t rv;
bb = ap_brigade_create(f->r->pool);
b = ap_bucket_create_eos();
AP_BRIGADE_INSERT_TAIL(bb, b);
- return ap_pass_brigade(f->next, bb);
+ rv = ap_pass_brigade(f->next, bb);
+ if (rv != APR_SUCCESS) {
+ ctx->ees = EES_DOWNSTREAM;
+ }
+ return rv;
}
static apr_status_t set_aside_partial_char(charset_filter_ctx_t *ctx,
@@ -542,18 +555,22 @@
const char *msg;
char msgbuf[100];
int cur;
+ int flags = APLOG_ERR;
switch(ctx->ees) {
case EES_LIMIT:
+ flags |= APLOG_NOERRNO;
msg = "xlate filter - a built-in restriction was encountered";
break;
case EES_BAD_INPUT:
+ flags |= APLOG_NOERRNO;
msg = "xlate filter - an input character was invalid";
break;
case EES_BUCKET_READ:
msg = "xlate filter - bucket read routine failed";
break;
case EES_INCOMPLETE_CHAR:
+ flags |= APLOG_NOERRNO;
strcpy(msgbuf, "xlate filter - incomplete char at end of input - ");
cur = 0;
while (cur < ctx->saved) {
@@ -563,10 +580,13 @@
}
msg = msgbuf;
break;
+ case EES_DOWNSTREAM:
+ msg = "xlate filter - an error occurred in a lower filter";
+ break;
default:
msg = "xlate filter - returning error";
}
- ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, rv, f->r,
+ ap_log_rerror(APLOG_MARK, flags, rv, f->r,
"%s", msg);
}