httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@locus.apache.org
Subject cvs commit: apache-2.0/src/main http_core.c http_protocol.c util_filter.c
Date Tue, 29 Aug 2000 22:16:46 GMT
rbb         00/08/29 15:16:46

  Modified:    src/include util_filter.h
               src/main http_core.c http_protocol.c util_filter.c
  Log:
  Modify the way filters are added to the server.  Instead of using a FIFO,
  we use a modified LIFO.  It is modified, because if we add a filter while
  in the middle of another filter, the added filter gets put in after the
  current filter.  This requires that the server is smart about which filters
  are added when.  This should be handled by the HTTP protocol, but we will
  want to keep and eye on things for a little while.
  
  This change is necessary, because currently when we add a filter it goes
  after the last filter of the same type.  This is broken whenever we want
  to add a filter that has a dependancy.  Think about the core and chunking
  filters.  They are of the same type, and core is always added first.  When
  we go to insert chunking, it gets added, but it is never called.
  
  Revision  Changes    Path
  1.12      +11 -5     apache-2.0/src/include/util_filter.h
  
  Index: util_filter.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/include/util_filter.h,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- util_filter.h	2000/08/29 20:57:26	1.11
  +++ util_filter.h	2000/08/29 22:16:44	1.12
  @@ -255,18 +255,24 @@
    * from another request, then this filter will be added before those other
    * filters.
    * 
  - * To re-iterate that last comment.  This function is building a FIFO
  + * To re-iterate that last comment.  This function is building a LIFO
    * list of filters.  Take note of that when adding your filter to the chain.
    */
   /**
  - * Add a filter to the current request.  Filters are added in a FIFO manner.
  - * The first filter added will be the first filter called.
  + * Add a filter to the current request.  Filters are added in a LIFO manner.
  + * The first filter added will be the last filter called.
    * @param name The name of the filter to add
    * @param ctx Any filter specific data to associate with the filter
    * @param r The request to add this filter for.
  - * @deffunc void ap_add_filter(const char *name, void *ctx, request_rec *r)
  + * @param curr The filter to add this filter after.  This is incredibly useful
  + *             if you are adding a filter while executing another filter.  The
  + *             new filter should be added immediately after the current filter.
  + *             By passing the current filter into ap_add_filter, this is
  + *             accomplished easily.
  + * @deffunc void ap_add_filter(const char *name, void *ctx, request_rec *r, ap_filter_t
*curr)
    */
  -API_EXPORT(void) ap_add_filter(const char *name, void *ctx, request_rec *r);
  +API_EXPORT(void) ap_add_filter(const char *name, void *ctx, request_rec *r,
  +                               ap_filter_t *curr);
   
   /* The next two filters are for abstraction purposes only.  They could be
    * done away with, but that would require that we break modules if we ever
  
  
  
  1.110     +2 -2      apache-2.0/src/main/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_core.c,v
  retrieving revision 1.109
  retrieving revision 1.110
  diff -u -r1.109 -r1.110
  --- http_core.c	2000/08/29 20:57:26	1.109
  +++ http_core.c	2000/08/29 22:16:44	1.110
  @@ -3089,7 +3089,7 @@
   
   static void core_register_filter(request_rec *r)
   {
  -    ap_add_filter("CORE", NULL, r);
  +    ap_add_filter("CORE", NULL, r, NULL);
   }
   
   static void register_hooks(void)
  @@ -3109,7 +3109,7 @@
        * request-processing time.
        */
       ap_hook_insert_filter(core_register_filter, NULL, NULL, AP_HOOK_MIDDLE);
  -    ap_register_filter("CORE", core_filter, AP_FTYPE_CONNECTION + 1);
  +    ap_register_filter("CORE", core_filter, AP_FTYPE_CONNECTION);
       ap_register_filter("CHUNK", chunk_filter, AP_FTYPE_CONNECTION);
   }
   
  
  
  
  1.117     +1 -1      apache-2.0/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v
  retrieving revision 1.116
  retrieving revision 1.117
  diff -u -r1.116 -r1.117
  --- http_protocol.c	2000/08/29 20:57:26	1.116
  +++ http_protocol.c	2000/08/29 22:16:45	1.117
  @@ -1862,7 +1862,7 @@
       if (r->chunked) {
           apr_table_mergen(r->headers_out, "Transfer-Encoding", "chunked");
           apr_table_unset(r->headers_out, "Content-Length");
  -        ap_add_filter("CHUNK", NULL, r);
  +        ap_add_filter("CHUNK", NULL, r, NULL);
       }
   
       if (r->byterange > 1)
  
  
  
  1.11      +7 -10     apache-2.0/src/main/util_filter.c
  
  Index: util_filter.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/util_filter.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- util_filter.c	2000/08/29 20:57:27	1.10
  +++ util_filter.c	2000/08/29 22:16:45	1.11
  @@ -117,7 +117,8 @@
       apr_register_cleanup(FILTER_POOL, NULL, filter_cleanup, apr_null_cleanup);
   }
   
  -API_EXPORT(void) ap_add_filter(const char *name, void *ctx, request_rec *r)
  +API_EXPORT(void) ap_add_filter(const char *name, void *ctx, request_rec *r,
  +                               ap_filter_t *curr)
   {
       ap_filter_rec_t *frec = registered_filters;
   
  @@ -130,18 +131,14 @@
               f->ftype = frec->ftype;
               f->r = r;
   
  -            if (INSERT_BEFORE(f, r->filters)) {
  -                f->next = r->filters;
  -                r->filters = f;
  +            if (curr) {
  +                f->next = curr->next;
  +                curr->next = f;
               }
               else {
  -                ap_filter_t *fscan = r->filters;
  -                while (!INSERT_BEFORE(f, fscan->next))
  -                    fscan = fscan->next;
  -                f->next = fscan->next;
  -                fscan->next = f;
  +                f->next = r->filters;
  +                r->filters = f;
               }
  -
               break;
           }
       }
  
  
  

Mime
View raw message