httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject cvs commit: httpd-2.0/server protocol.c request.c util_filter.c
Date Sun, 03 Mar 2002 22:04:04 GMT
rbb         02/03/03 14:04:04

  Modified:    server   protocol.c request.c util_filter.c
  Log:
  This fixes most of the header bug that was committed last night.  The server
  is seg faulting on pipelined requests currently, but I want to get people
  back to a running server.
  
  Revision  Changes    Path
  1.87      +4 -0      httpd-2.0/server/protocol.c
  
  Index: protocol.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/protocol.c,v
  retrieving revision 1.86
  retrieving revision 1.87
  diff -u -r1.86 -r1.87
  --- protocol.c	3 Mar 2002 02:15:52 -0000	1.86
  +++ protocol.c	3 Mar 2002 22:04:03 -0000	1.87
  @@ -776,6 +776,10 @@
   
       r->request_config  = ap_create_request_config(r->pool);
       /* Must be set before we run create request hook */
  +
  +    conn->output_filters->prev = NULL;
  +    conn->input_filters->prev = NULL;
  +
       r->proto_output_filters = conn->output_filters;
       r->output_filters  = r->proto_output_filters;
       r->proto_input_filters = conn->input_filters;
  
  
  
  1.101     +6 -1      httpd-2.0/server/request.c
  
  Index: request.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/request.c,v
  retrieving revision 1.100
  retrieving revision 1.101
  diff -u -r1.100 -r1.101
  --- request.c	3 Mar 2002 02:15:52 -0000	1.100
  +++ request.c	3 Mar 2002 22:04:03 -0000	1.101
  @@ -1492,7 +1492,12 @@
   
       /* start with the same set of output filters */
       if (next_filter) {
  -        /* no input filters for a subrequest */
  +        /* while there are no input filters for a subrequest, we will
  +         * try to insert some, so if we don't have valid data, the code
  +         * will seg fault.
  +         */
  +        rnew->input_filters  = r->input_filters;
  +        rnew->proto_input_filters  = r->proto_input_filters;
           rnew->output_filters = next_filter;
           ap_add_output_filter_handle(ap_subreq_core_filter_handle,
                                       NULL, rnew, rnew->connection); 
  
  
  
  1.81      +78 -112   httpd-2.0/server/util_filter.c
  
  Index: util_filter.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/util_filter.c,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- util_filter.c	3 Mar 2002 06:04:08 -0000	1.80
  +++ util_filter.c	3 Mar 2002 22:04:03 -0000	1.81
  @@ -291,108 +291,6 @@
       return register_filter(name, f, ftype, &registered_output_filters);
   }
   
  -static ap_filter_t *add_any_filter(const char *name, void *ctx, 
  -                                   request_rec *r, conn_rec *c, 
  -                                   const filter_trie_node *reg_filter_set,
  -                                   ap_filter_t **r_filters, 
  -                                   ap_filter_t **p_filters,
  -                                   ap_filter_t **c_filters)
  -{
  -    if (reg_filter_set) {
  -        const char *n;
  -        const filter_trie_node *node;
  -
  -        node = reg_filter_set;
  -        for (n = name; *n; n++) {
  -            int start, end;
  -            start = 0;
  -            end = node->nchildren - 1;
  -            while (end >= start) {
  -                int middle = (end + start) / 2;
  -                char ch = node->children[middle].c;
  -                if (*n == ch) {
  -                    node = node->children[middle].child;
  -                    break;
  -                }
  -                else if (*n < ch) {
  -                    end = middle - 1;
  -                }
  -                else {
  -                    start = middle + 1;
  -                }
  -            }
  -            if (end < start) {
  -                node = NULL;
  -                break;
  -            }
  -        }
  -
  -        if (node && node->frec) {
  -            apr_pool_t* p = r ? r->pool : c->pool;
  -            ap_filter_t *f = apr_palloc(p, sizeof(*f));
  -            ap_filter_t **outf;
  -
  -            if (node->frec->ftype < AP_FTYPE_HTTP_HEADER) {
  -                if (r) {
  -                    outf = r_filters;
  -                }
  -                else {
  -                    ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, NULL,
  -                                 "a content filter was added without a request: %s", name);
  -                    return NULL;
  -                }
  -            }
  -            else if (node->frec->ftype < AP_FTYPE_CONNECTION) {
  -                if (r) {
  -                    outf = p_filters;
  -                }
  -                else {
  -                    ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, NULL,
  -                                 "a protocol filter was added without a request: %s", name);
  -                    return NULL;
  -                }
  -            }
  -            else {
  -                outf = c_filters;
  -            }
  -
  -            f->frec = node->frec;
  -            f->ctx = ctx;
  -            f->r = r;
  -            f->c = c;
  -
  -            if (INSERT_BEFORE(f, *outf)) {
  -                f->next = *outf;
  -                if ((*outf) && (*outf)->prev) {
  -                    f->prev = (*outf)->prev;
  -                    (*outf)->prev->next = f;
  -                    (*outf)->prev = f;
  -                }
  -                else {
  -                    f->prev = NULL;
  -                }
  -                *outf = f;
  -            }
  -            else {
  -                ap_filter_t *fscan = *outf;
  -                while (!INSERT_BEFORE(f, fscan->next))
  -                    fscan = fscan->next;
  -
  -                f->next = fscan->next;
  -                f->prev = fscan;
  -                fscan->next->prev = f;
  -                fscan->next = f;
  -            }
  -
  -            return f;
  -        }
  -    }
  -
  -    ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, NULL,
  -                 "an unknown filter was not added: %s", name);
  -    return NULL;
  -}
  -
   static ap_filter_t *add_any_filter_handle(ap_filter_rec_t *frec, void *ctx, 
                                             request_rec *r, conn_rec *c, 
                                             ap_filter_t **r_filters,
  @@ -431,16 +329,33 @@
       f->ctx = ctx;
       f->r = r;
       f->c = c;
  +    f->next = f->prev = NULL;
   
       if (INSERT_BEFORE(f, *outf)) {
           f->next = *outf;
  -        if ((*outf) && (*outf)->prev) {
  -            f->prev = (*outf)->prev;
  -            (*outf)->prev->next = f;
  -            (*outf)->prev = f;
  -        }
  -        else {
  -            f->prev = NULL;
  +
  +        if (*outf) {
  +            ap_filter_t *first = NULL;
  +
  +            if (r) {
  +                /* If we are adding our first non-connection filter,
  +                 * Then don't try to find the right location, it is
  +                 * automatically first.
  +                 */
  +                if (*r_filters != *c_filters) {
  +                    first = *r_filters;
  +                    while (first && first->next && (first->next !=
(*outf))) {
  +                        first = first->next;
  +                    }
  +                }
  +            }
  +            if (first && first != (*outf)) {
  +                first->next = f;
  +                f->prev = first;
  +            }
  +            if (*outf && ((*outf)->prev == first)) {
  +                (*outf)->prev = f;
  +            }
           }
           *outf = f;
       }
  @@ -450,14 +365,63 @@
               fscan = fscan->next;
   
           f->next = fscan->next;
  -        f->prev = fscan;
  -        fscan->next->prev = f;
  -        fscan->next = f;
  +        if (fscan->next->prev == fscan) {
  +            f->prev = fscan;
  +            fscan->next->prev = f;
  +            fscan->next = f;
  +        }
       }
   
       return f;
   }
   
  +static ap_filter_t *add_any_filter(const char *name, void *ctx, 
  +                                   request_rec *r, conn_rec *c, 
  +                                   const filter_trie_node *reg_filter_set,
  +                                   ap_filter_t **r_filters, 
  +                                   ap_filter_t **p_filters,
  +                                   ap_filter_t **c_filters)
  +{
  +    if (reg_filter_set) {
  +        const char *n;
  +        const filter_trie_node *node;
  +
  +        node = reg_filter_set;
  +        for (n = name; *n; n++) {
  +            int start, end;
  +            start = 0;
  +            end = node->nchildren - 1;
  +            while (end >= start) {
  +                int middle = (end + start) / 2;
  +                char ch = node->children[middle].c;
  +                if (*n == ch) {
  +                    node = node->children[middle].child;
  +                    break;
  +                }
  +                else if (*n < ch) {
  +                    end = middle - 1;
  +                }
  +                else {
  +                    start = middle + 1;
  +                }
  +            }
  +            if (end < start) {
  +                node = NULL;
  +                break;
  +            }
  +        }
  +
  +        if (node && node->frec) {
  +            add_any_filter_handle(node->frec, ctx, r, c, r_filters, p_filters,
  +                                  c_filters);
  +        }
  +    }
  +
  +    ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, NULL,
  +                 "an unknown filter was not added: %s", name);
  +    return NULL;
  +}
  +
   AP_DECLARE(ap_filter_t *) ap_add_input_filter(const char *name, void *ctx,
                                                 request_rec *r, conn_rec *c)
   {
  @@ -502,6 +466,7 @@
   
       if (*curr == f) {
           *curr = (*curr)->next;
  +        (*curr)->prev = NULL;
           return;
       }
   
  @@ -512,6 +477,7 @@
       }
   
       fscan->next = f->next;
  +    f->next->prev = fscan;
   }
   
   AP_DECLARE(void) ap_remove_input_filter(ap_filter_t *f)
  
  
  

Mime
View raw message