You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Dean Gaudet <dg...@hyperreal.com> on 1997/06/27 04:20:22 UTC

cvs commit: apache/src CHANGES mod_negotiation.c

dgaudet     97/06/26 19:20:21

  Modified:    src       Tag: APACHE_1_2_X  CHANGES mod_negotiation.c
  Log:
  PR#94: Content negot fails unless each varient has a charset
  
  Reviewed by:	Dean, Alexei
  Submitted by:	Paul Sutton
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.286.2.11 +4 -0      apache/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.286.2.10
  retrieving revision 1.286.2.11
  diff -C3 -r1.286.2.10 -r1.286.2.11
  *** CHANGES	1997/06/27 02:15:05	1.286.2.10
  --- CHANGES	1997/06/27 02:20:18	1.286.2.11
  ***************
  *** 1,4 ****
  --- 1,8 ----
    Changes with Apache 1.2.1
  +   
  +   *) If an object has multiple variants that are otherwise equal Apache
  +      would prefer the last listed variant rather than the first.
  +      [Paul Sutton] PR#94
    
      *) "HostnameLookups" now defaults to off because it is far better for
         the net if we require people that actually need this data to
  
  
  
  1.40.2.1  +19 -11    apache/src/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_negotiation.c,v
  retrieving revision 1.40
  retrieving revision 1.40.2.1
  diff -C3 -r1.40 -r1.40.2.1
  *** mod_negotiation.c	1997/04/17 02:50:20	1.40
  --- mod_negotiation.c	1997/06/27 02:20:19	1.40.2.1
  ***************
  *** 642,658 ****
        return cp;
    }
    
  ! int read_type_map (negotiation_state *neg, char *map_name)
    {
        request_rec *r = neg->r;
  !     FILE *map = pfopen (neg->pool, map_name, "r");
  ! 
        char buffer[MAX_STRING_LEN];
        enum header_state hstate;
        struct var_rec mime_info;
        
        if (map == NULL) {
  !         log_reason("cannot access type map file", map_name, r);
    	return FORBIDDEN;
        }
    
  --- 642,661 ----
        return cp;
    }
    
  ! static int read_type_map (negotiation_state *neg, request_rec *rr)
    {
        request_rec *r = neg->r;
  !     FILE *map;
        char buffer[MAX_STRING_LEN];
        enum header_state hstate;
        struct var_rec mime_info;
        
  +     if (rr->status != HTTP_OK) {
  + 	return rr->status;
  +     }
  +     map = pfopen (neg->pool, rr->filename, "r");
        if (map == NULL) {
  !         log_reason("cannot access type map file", rr->filename, r);
    	return FORBIDDEN;
        }
    
  ***************
  *** 780,786 ****
    	    closedir(dirp);
    	    
    	    neg->avail_vars->nelts = 0;
  ! 	    return read_type_map (neg, sub_req->filename);
    	}
    	
    	/* Have reasonable variant --- gather notes.
  --- 783,789 ----
    	    closedir(dirp);
    	    
    	    neg->avail_vars->nelts = 0;
  ! 	    return read_type_map (neg, sub_req);
    	}
    	
    	/* Have reasonable variant --- gather notes.
  ***************
  *** 1439,1446 ****
            /* If the best variant's charset is ISO-8859-1 and this variant has
               the same charset quality, then we prefer this variant */
            if (variant->charset_quality == best->charset_quality &&
  !             (best->content_charset == NULL || *best->content_charset == 0 ||
  !             strcmp(best->content_charset, "iso-8859-1") == 0)) {
                *p_bestq = q;
                return 1;
    	}
  --- 1442,1452 ----
            /* If the best variant's charset is ISO-8859-1 and this variant has
               the same charset quality, then we prefer this variant */
            if (variant->charset_quality == best->charset_quality &&
  !             (variant->content_charset != NULL &&
  !              strcmp(variant->content_charset, "iso-8859-1") != 0) &&
  !             (best->content_charset == NULL ||
  !              *best->content_charset == '\0' ||
  !              strcmp(best->content_charset, "iso-8859-1") == 0)) {
                *p_bestq = q;
                return 1;
    	}
  ***************
  *** 1538,1546 ****
        /* If the best variant's charset is ISO-8859-1 and this variant has
           the same charset quality, then we prefer this variant */
        if (variant->charset_quality > best->charset_quality ||
  !         (variant->charset_quality == best->charset_quality &&
  !         (best->content_charset == NULL || *best->content_charset == 0 ||
  !         strcmp(best->content_charset, "iso-8859-1") == 0))) {
            *p_bestq = q;
            return 1;
        }
  --- 1544,1554 ----
        /* If the best variant's charset is ISO-8859-1 and this variant has
           the same charset quality, then we prefer this variant */
        if (variant->charset_quality > best->charset_quality ||
  ! 	((variant->content_charset != NULL &&
  ! 	  strcmp(variant->content_charset, "iso-8859-1") != 0) &&
  ! 	 (best->content_charset == NULL ||
  ! 	  *best->content_charset == '\0' ||
  ! 	  strcmp(best->content_charset, "iso-8859-1") == 0))) {
            *p_bestq = q;
            return 1;
        }
  ***************
  *** 1850,1856 ****
        
        char *udir;
        
  !     if ((res = read_type_map (neg, r->filename))) return res;
        
        maybe_add_default_encodings(neg, 0);
        
  --- 1858,1864 ----
        
        char *udir;
        
  !     if ((res = read_type_map (neg, r))) return res;
        
        maybe_add_default_encodings(neg, 0);