httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@locus.apache.org
Subject cvs commit: apache-2.0/src/main http_core.c
Date Wed, 04 Oct 2000 17:14:02 GMT
trawick     00/10/04 10:14:01

  Modified:    src/main http_core.c
  Log:
  Clean up md5 digest support in default_handler() a bit:
  1) don't compute md5 if we have a content filter; it is almost always wrong
  2) add note about adding md5 filter in the future; this can be done
  3) delete some APACHE_XLATE/CHARSET_EBCDIC baggage associated with md5
     digest support; part of this deleted baggage is a segfault on
     subrequests referencing r->rrx (which is not allocated for subrequests)
  
  Revision  Changes    Path
  1.140     +15 -26    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.139
  retrieving revision 1.140
  diff -u -r1.139 -r1.140
  --- http_core.c	2000/10/03 21:56:43	1.139
  +++ http_core.c	2000/10/04 17:14:00	1.140
  @@ -2839,6 +2839,15 @@
   #ifdef USE_MMAP_FILES
       apr_mmap_t *mm = NULL;
   #endif
  +    /* XXX if/when somebody writes a content-md5 filter we either need to
  +     *     remove this support or coordinate when to use the filter vs.
  +     *     when to use this code
  +     *     The current choice of when to compute the md5 here matches the 1.3
  +     *     support fairly closely (unlike 1.3, we don't handle computing md5
  +     *     when the charset is translated).
  +     */
  +    int bld_content_md5 = 
  +        (d->content_md5 & 1) && r->output_filters->frec->ftype
!= AP_FTYPE_CONTENT;
   
       /* This handler has no use for a request body (yet), but we still
        * need to read and discard it if the client sent one.
  @@ -2886,22 +2895,10 @@
           return errstatus;
       }
   
  -#ifdef CHARSET_EBCDIC
  -    if (d->content_md5 & 1) {
  -        /* The call to ap_checkconv() in ap_send_http_header() is
  -         * sufficient for most paths.  Sending the MD5 digest in a
  -         * header is special in that any change to translation decided
  -         * by ap_checkconv() must be done before building that header,
  -         * and thus before calling ap_send_http_header().
  -         */
  -        ap_checkconv(r);
  -    }
  -#endif /* CHARSET_EBCDIC */
  -      
   #ifdef USE_MMAP_FILES
       if ((r->finfo.size >= MMAP_THRESHOLD)
   	&& (r->finfo.size < MMAP_LIMIT)
  -	&& (!r->header_only || (d->content_md5 & 1))) {
  +	&& (!r->header_only || bld_content_md5)) {
   	/* we need to protect ourselves in case we die while we've got the
    	 * file mmapped */
           apr_status_t status;
  @@ -2918,18 +2915,15 @@
       if (mm == NULL) {
   #endif
   
  +        if (bld_content_md5) {
   #ifdef APACHE_XLATE
  -	if (d->content_md5 & 1) {
   	    apr_table_setn(r->headers_out, "Content-MD5",
  -			  ap_md5digest(r->pool, fd,
  -                                       r->rrx->to_net));
  -	}
  +                           ap_md5digest(r->pool, fd, NULL));
   #else
  -	if (d->content_md5 & 1) {
   	    apr_table_setn(r->headers_out, "Content-MD5",
  -			  ap_md5digest(r->pool, fd));
  -	}
  +                           ap_md5digest(r->pool, fd));
   #endif /* APACHE_XLATE */
  +	}
   
   	rangestatus = ap_set_byterange(r);
   
  @@ -2960,15 +2954,10 @@
   	unsigned char *addr;
           apr_mmap_offset((void**)&addr, mm ,0);
   
  -	if (d->content_md5 & 1) {
  +	if (bld_content_md5) {
   	    apr_md5_ctx_t context;
   	    
   	    apr_MD5Init(&context);
  -#ifdef APACHE_XLATE
  -            if (r->rrx->to_net) {
  -                apr_MD5SetXlate(&context, r->rrx->to_net);
  -            }
  -#endif
   	    apr_MD5Update(&context, addr, (unsigned int)r->finfo.size);
   	    apr_table_setn(r->headers_out, "Content-MD5",
   			  ap_md5contextTo64(r->pool, &context));
  
  
  

Mime
View raw message