]> granicus.if.org Git - apache/commitdiff
change filter name to CaseFilterIn (mod_case_filter.c already uses CaseFilter)
authorDoug MacEachern <dougm@apache.org>
Mon, 20 Aug 2001 02:43:02 +0000 (02:43 +0000)
committerDoug MacEachern <dougm@apache.org>
Mon, 20 Aug 2001 02:43:02 +0000 (02:43 +0000)
allow filter to be configured without 'CaseFilterIn On'
PR:
Obtained from:
Submitted by:
Reviewed by:

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90383 13f79535-47bb-0310-9956-ffa450edef68

modules/experimental/mod_case_filter_in.c

index 0c8efd7602df9c239a7f6d26e2d9dfc86e611b0a..0975145606f0604ce855c9e1fd0c19eac20849b8 100644 (file)
@@ -66,7 +66,7 @@
 
 #include <ctype.h>
 
-static const char s_szCaseFilterName[]="CaseFilter";
+static const char s_szCaseFilterName[]="CaseFilterIn";
 module AP_MODULE_DECLARE_DATA case_filter_in_module;
 
 typedef struct
@@ -92,28 +92,31 @@ static void CaseFilterInInsertFilter(request_rec *r)
 {
     CaseFilterInConfig *pConfig=ap_get_module_config(r->server->module_config,
                                                     &case_filter_in_module);
-    CaseFilterInContext *pCtx;
-
     if(!pConfig->bEnabled)
        return;
 
-    pCtx=apr_palloc(r->pool,sizeof *pCtx);
-    pCtx->pbbTmp=apr_brigade_create(r->pool);
-    ap_add_input_filter(s_szCaseFilterName,pCtx,r,NULL);
+    ap_add_input_filter(s_szCaseFilterName,NULL,r,NULL);
 }
 
 static apr_status_t CaseFilterInFilter(ap_filter_t *f,
                                       apr_bucket_brigade *pbbOut,
                                       ap_input_mode_t eMode,apr_off_t *nBytes)
 {
-    CaseFilterInContext *pCtx=f->ctx;
+    request_rec *r = f->r;
+    CaseFilterInContext *pCtx;
     apr_status_t ret;
 
-    ap_assert(APR_BRIGADE_EMPTY(pCtx->pbbTmp));
-    
-    ret=ap_get_brigade(f->next,pCtx->pbbTmp,eMode,nBytes);
-    if(eMode == AP_MODE_PEEK || ret != APR_SUCCESS)
-       return ret;
+    if (!(pCtx = f->ctx)) {
+        f->ctx = pCtx = apr_palloc(r->pool, sizeof *pCtx);
+        pCtx->pbbTmp = apr_brigade_create(r->pool);
+    }
+
+    if (APR_BRIGADE_EMPTY(pCtx->pbbTmp)) {
+        ret = ap_get_brigade(f->next,pCtx->pbbTmp,eMode,nBytes);
+
+        if(eMode == AP_MODE_PEEK || ret != APR_SUCCESS)
+            return ret;
+    }
 
     while(!APR_BRIGADE_EMPTY(pCtx->pbbTmp)) {
        apr_bucket *pbktIn=APR_BRIGADE_FIRST(pCtx->pbbTmp);