httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexei Kosut <ako...@nueva.pvt.k12.ca.us>
Subject Re: Problems with Content Negociation (fwd)
Date Thu, 16 May 1996 02:59:11 GMT
At any rate, I believe that this problem in content negotation
consitutes a bug, and therefore we should fix it. As I've shown, the
spec does reccomend that we choose more specific accept types over
wilcard entries with the same quality value.

Here's a simple patch to fix it, that should be completely legal,
spec-wise, and won't break anything. I'd like to see it in the next
1.1 beta.

Index: mod_negotiation.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_negotiation.c,v
retrieving revision 1.6
diff -c -r1.6 mod_negotiation.c
*** mod_negotiation.c	1996/04/17 14:02:17	1.6
--- mod_negotiation.c	1996/05/16 02:56:14
***************
*** 358,363 ****
--- 358,380 ----
  	    result->level = atof(cp);
      }
  
+     /* Now we do a little tweaking of wildcard entries. This is so that
+      * "Accept: star/star, text/html" will take HTML over anything else.
+      * This is the correct behavior, and the way we do it is completely
+      * legal, since a quality value can have no more than three decimal
+      * points.
+      * 
+      * We check the current value so that we don't get negative quality
+      * values, which could be bad.
+      */
+ 
+     /* star/star case first */
+     if ((result->type_name[0] == '*') && (result->quality > 0.0002))
+       result->quality -= 0.0002;
+     /* Now type/star cases */
+     else if ((strchr(result->type_name, '*')) && (result->quality > 0.0001))
+       result->quality -= 0.0001;
+ 
      if (*accept_line == ',') ++accept_line;
  
      return accept_line;


-- 
________________________________________________________________________
Alexei Kosut <akosut@nueva.pvt.k12.ca.us>      The Apache HTTP Server
URL: http://www.nueva.pvt.k12.ca.us/~akosut/   http://www.apache.org/
 
      "War does not determine who is right, only who is left."


Mime
View raw message