fielding    97/05/26 21:14:22

  Modified:    src       alloc.h alloc.c http_protocol.c
  Log:
  Two problems were introduced by the two "error responses have wrong headers"
  patches committed a couple weeks ago.  The first is that a NULL table
  causes mod_log_config to SIGSEGV on a call to table_get; the second is
  that Location needs to be added to the output header table for redirects.
  
  Submitted by: Roy Fielding and Ed Korthof
  Reviewed by: Jim Jagielski, Randy Terbush
  
  Revision  Changes    Path
  1.21      +1 -0      apache/src/alloc.h
  
  Index: alloc.h
  ===================================================================
  RCS file: /export/home/cvs/apache/src/alloc.h,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -C3 -r1.20 -r1.21
  *** alloc.h   1997/05/14 19:22:52     1.20
  --- alloc.h   1997/05/27 04:14:19     1.21
  ***************
  *** 144,149 ****
  --- 144,150 ----
    
    table *make_table (pool *p, int nelts);
    table *copy_table (pool *p, const table *);     
  + void clear_table (table *);     
    char *table_get (const table *, const char *);
    void table_set (table *, const char *name, const char *val);
    void table_merge (table *, const char *name, const char *more_val);
  
  
  
  1.28      +5 -0      apache/src/alloc.c
  
  Index: alloc.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/alloc.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -C3 -r1.27 -r1.28
  *** alloc.c   1997/04/24 23:35:18     1.27
  --- alloc.c   1997/05/27 04:14:20     1.28
  ***************
  *** 552,557 ****
  --- 552,562 ----
        return copy_array (p, t);
    }
    
  + void clear_table (table *t)
  + {
  +     t->nelts = 0;
  + }
  + 
    array_header *table_elts (table *t) { return t; }
    
    char *table_get (const table *t, const char *key)
  
  
  
  1.122     +9 -2      apache/src/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_protocol.c,v
  retrieving revision 1.121
  retrieving revision 1.122
  diff -C3 -r1.121 -r1.122
  *** http_protocol.c   1997/05/14 19:22:53     1.121
  --- http_protocol.c   1997/05/27 04:14:20     1.122
  ***************
  *** 1692,1705 ****
        }
    
        if (!r->assbackwards) {
      
        /* For all HTTP/1.x responses for which we generate the message,
         * we need to avoid inheriting the "normal status" header fields
         * that may have been set by the request handler before the
  !      * error or redirect.
         */
        r->headers_out = r->err_headers_out;
  !     r->err_headers_out = NULL;
        r->content_language = NULL;
        r->content_languages = NULL;
        r->content_encoding = NULL;
  --- 1692,1712 ----
        }
    
        if (!r->assbackwards) {
  +     table *tmp = r->headers_out;
      
        /* For all HTTP/1.x responses for which we generate the message,
         * we need to avoid inheriting the "normal status" header fields
         * that may have been set by the request handler before the
  !      * error or redirect, except for Location on external redirects.
         */
        r->headers_out = r->err_headers_out;
  !     r->err_headers_out = tmp;
  !     clear_table(r->err_headers_out);
  ! 
  !     if (location && *location
  !                  && (is_HTTP_REDIRECT(status) || status == HTTP_CREATED))
  !         table_set(r->headers_out, "Location", location);
  ! 
        r->content_language = NULL;
        r->content_languages = NULL;
        r->content_encoding = NULL;
  
  
  

Reply via email to