I made some minor formatting changes to your final patch as well as a code change to an area you were concerned about.
Philipp Reisner wrote:
Am Montag, 23. Juni 2003 03:56 schrieb Jeff Trawick:
BTW, Please have a close look to the part where I look at the "Content-Type" header. The old code examien r->content_type. I had to find an other way, one that is also possible for request filtering...
r->content_type is set in cases where the Content-Type header in r->headers_out is not accurate
For input filters I left the checking for Content-Type alone, but for output filters I changed it back to the way it worked previously. The code is not as pretty as yours, but as ap_set_content_type() does not bother to fill in r->headers_out, the difference is necessary.
from your patch:
- if (!f->r->content_type) {
- ctx->noop = 1;
- }
- else {
- const char *ctypes = f->r->content_type;
- const char *ctype = ap_getword(f->r->pool, &ctypes, ';');
-
- if (strcasecmp(ctx->filter->intype, ctype)) {
- /* wrong IMT for us; don't mess with the output */
- ctx->noop = 1;
- }
- }
+ const char *ctypes = apr_table_get(ctx->filter->mode == INPUT_FILTER ?
+ f->r->headers_in : f->r->headers_out,
+ "Content-Type");
