httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apache-1.3/src/modules/standard mod_autoindex.c
Date Wed, 18 Dec 2002 22:27:55 GMT
wrowe       2002/12/18 14:27:55

  Modified:    src/modules/standard mod_autoindex.c
  Log:
    Apply a fix already in Apache 2.0 (and add quality weights) to prevent
    us from attempting to serve .gif or any other flavor of negotiated
    resources.
  
    This patch fixes the Accept: header of the autoindex request so that
    it's subrequests look for text/ only, with weights applied to recover
    .html, then .txt, then some other flavor of text/* in their absense.
  
  Revision  Changes    Path
  1.124     +46 -0     apache-1.3/src/modules/standard/mod_autoindex.c
  
  Index: mod_autoindex.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v
  retrieving revision 1.123
  retrieving revision 1.124
  diff -u -r1.123 -r1.124
  --- mod_autoindex.c	13 Mar 2002 21:05:33 -0000	1.123
  +++ mod_autoindex.c	18 Dec 2002 22:27:54 -0000	1.124
  @@ -1000,6 +1000,18 @@
       request_rec *rr = NULL;
       int emit_amble = 1;
       int emit_H1 = 1;
  +    const char *r_accept;
  +    const char *r_accept_enc;
  +    table *hdrs = r->headers_in;
  +
  +    /*
  +     * If there's a header file, send a subrequest to look for it.  If it's
  +     * found and html do the subrequest, otherwise handle it
  +     */
  +    r_accept = ap_table_get(hdrs, "Accept");
  +    r_accept_enc = ap_table_get(hdrs, "Accept-Encoding");
  +    ap_table_setn(hdrs, "Accept", "text/html, text/plain;q=.5, text/*;q=.1");
  +    ap_table_unset(hdrs, "Accept-Encoding");
   
       /*
        * If there's a header file, send a subrequest to look for it.  If it's
  @@ -1061,6 +1073,17 @@
   	}
       }
   
  +    if (r_accept) {
  +        ap_table_setn(hdrs, "Accept", r_accept);
  +    }
  +    else {
  +        ap_table_unset(hdrs, "Accept");
  +    }
  +
  +    if (r_accept_enc) {
  +        ap_table_setn(hdrs, "Accept-Encoding", r_accept_enc);
  +    }
  +
       if (emit_amble) {
   	emit_preamble(r, title);
       }
  @@ -1088,6 +1111,18 @@
       request_rec *rr = NULL;
       int suppress_post = 0;
       int suppress_sig = 0;
  +    const char *r_accept;
  +    const char *r_accept_enc;
  +    table *hdrs = r->headers_in;
  +
  +    /*
  +     * If there's a readme file, send a subrequest to look for it.  If it's
  +     * found and html do the subrequest, otherwise handle it
  +     */
  +    r_accept = ap_table_get(hdrs, "Accept");
  +    r_accept_enc = ap_table_get(hdrs, "Accept-Encoding");
  +    ap_table_setn(hdrs, "Accept", "text/html, text/plain;q=.5, text/*;q=.1");
  +    ap_table_unset(hdrs, "Accept-Encoding");
   
       /*
        * If there's a readme file, send a subrequest to look for it.  If it's
  @@ -1132,6 +1167,17 @@
   	}
       }
       
  +    if (r_accept) {
  +        ap_table_setn(hdrs, "Accept", r_accept);
  +    }
  +    else {
  +        ap_table_unset(hdrs, "Accept");
  +    }
  +
  +    if (r_accept_enc) {
  +        ap_table_setn(hdrs, "Accept-Encoding", r_accept_enc);
  +    }
  +
       if (!suppress_sig) {
   	ap_rputs(ap_psignature("", r), r);
       }
  
  
  

Mime
View raw message