httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexei Kosut <ako...@hyperreal.com>
Subject cvs commit: apache/src mod_mime.c
Date Wed, 10 Apr 1996 00:27:58 GMT
akosut      96/04/09 17:27:58

  Modified:    src       mod_mime.c
  Log:
  Make it so that files with unknown extensions (e.g. foo.gif.bak)
  don't return content types they shouldn't (e.g. image/gif).
  
  Revision  Changes    Path
  1.7       +24 -4     apache/src/mod_mime.c
  
  Index: mod_mime.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_mime.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -C3 -r1.6 -r1.7
  *** mod_mime.c	1996/04/08 13:04:59	1.6
  --- mod_mime.c	1996/04/10 00:27:56	1.7
  ***************
  *** 217,231 ****
    
        /* Parse filename extensions, which can be in any order */
        while ((ext = getword(r->pool, &fn, '.')) && *ext) {
    
          /* Check for Content-Type */
          if ((type = table_get (conf->forced_types, ext))
  ! 	  || (type = table_get (hash_buckets[hash(*ext)], ext)))
  !         r->content_type = type;
    
          /* Check for Content-Language */
  !       if ((type = table_get (conf->language_types, ext)))
    	  r->content_language = type;
    	
          /* Check for Content-Encoding */
          if ((type = table_get (conf->encoding_types, ext))) {
  --- 217,236 ----
    
        /* Parse filename extensions, which can be in any order */
        while ((ext = getword(r->pool, &fn, '.')) && *ext) {
  +       int found = 0;
    
          /* Check for Content-Type */
          if ((type = table_get (conf->forced_types, ext))
  ! 	  || (type = table_get (hash_buckets[hash(*ext)], ext))) {
  !           r->content_type = type;
  ! 	  found = 1;
  !       }
    
          /* Check for Content-Language */
  !       if ((type = table_get (conf->language_types, ext))) {
    	  r->content_language = type;
  + 	  found = 1;
  +       }
    	
          /* Check for Content-Encoding */
          if ((type = table_get (conf->encoding_types, ext))) {
  ***************
  *** 234,243 ****
    	  else
    	      r->content_encoding = pstrcat(r->pool, r->content_encoding,
    					    ", ", type, NULL);
          }
          /* Check for a special handler, but not for proxy request */
  !       if ((type = table_get (conf->handlers, ext)) && !r->proxyreq)
    	  r->handler = type;
    
        }
    
  --- 239,263 ----
    	  else
    	      r->content_encoding = pstrcat(r->pool, r->content_encoding,
    					    ", ", type, NULL);
  + 	  found = 1;
          }
  + 
          /* Check for a special handler, but not for proxy request */
  !       if ((type = table_get (conf->handlers, ext)) && !r->proxyreq) {
    	  r->handler = type;
  + 	  found = 1;
  +       }
  + 
  +       /* This is to deal with cases such as foo.gif.bak, which we want
  +        * to not have a type. So if we find an unknown extension, we
  +        * zap the type/language/encoding (but not the handler)
  +        */
  + 
  +       if (!found) {
  + 	r->content_type = NULL;
  + 	r->content_language = NULL;
  + 	r->content_encoding = NULL;
  +       }
    
        }
    
  
  
  

Mime
View raw message