]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
PR#94: Content negot fails unless each varient has a charset
authordgaudet <dgaudet@unknown>
Fri, 27 Jun 1997 02:20:19 +0000 (02:20 +0000)
committerdgaudet <dgaudet@unknown>
Fri, 27 Jun 1997 02:20:19 +0000 (02:20 +0000)
Reviewed by: Dean, Alexei
Submitted by: Paul Sutton
Obtained from:

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3@78386 13f79535-47bb-0310-9956-ffa450edef68

APACHE_1_2_X/src/CHANGES
APACHE_1_2_X/src/modules/standard/mod_negotiation.c

index 4c0dd0e63789365cb73f52f517246340a38f86bd..4064a70e00979dae0c220c3dffe1a341e70109d5 100644 (file)
@@ -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
index 02be3f10e3817c3f0029e3a555c8cb89c8dce2cc..22645b66a42e32a25ad83a74377cccec8254f64a 100644 (file)
@@ -642,17 +642,20 @@ char *lcase_header_name_return_body (char *header, request_rec *r)
     return cp;
 }
 
-int read_type_map (negotiation_state *neg, char *map_name)
+static int read_type_map (negotiation_state *neg, request_rec *rr)
 {
     request_rec *r = neg->r;
-    FILE *map = pfopen (neg->pool, map_name, "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", map_name, r);
+        log_reason("cannot access type map file", rr->filename, r);
        return FORBIDDEN;
     }
 
@@ -780,7 +783,7 @@ int read_types_multi (negotiation_state *neg)
            closedir(dirp);
            
            neg->avail_vars->nelts = 0;
-           return read_type_map (neg, sub_req->filename);
+           return read_type_map (neg, sub_req);
        }
        
        /* Have reasonable variant --- gather notes.
@@ -1439,8 +1442,11 @@ int is_variant_better_na(negotiation_state *neg, var_rec *variant, var_rec *best
         /* 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)) {
+            (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,9 +1544,11 @@ float is_variant_better(negotiation_state *neg, var_rec *variant, var_rec *best,
     /* 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))) {
+       ((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,7 +1858,7 @@ int handle_map_file (request_rec *r)
     
     char *udir;
     
-    if ((res = read_type_map (neg, r->filename))) return res;
+    if ((res = read_type_map (neg, r))) return res;
     
     maybe_add_default_encodings(neg, 0);