httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 17564] New: - Somtimes mod_negotiation fails select right variant
Date Sat, 01 Mar 2003 19:43:02 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17564>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17564

Somtimes mod_negotiation fails  select right variant

           Summary: Somtimes mod_negotiation fails  select right variant
           Product: Apache httpd-1.3
           Version: 1.3.27
          Platform: PC
        OS/Version: FreeBSD
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Other mods
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: maxime@sochi.net.ru


Sometimes mod_negotiation fails to select right veriant. At once after restart
it works, but after several page reloads it get 406 Not Acceptaple. This hapens
if, for exaple, browse send following headers

Accept:text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1
Accept-Charset: KOI8-R, utf-8;q=0.66, *;q=0.66
Accept-Language: ru, en;q=0.66, fr;q=0.33

After server restart atof at line 392 of mod_negotiation.c:
 result->quality = (float)atof(cp);
works right

text/html Quality: 0.9 -> 0.900000
text/plain Quality: 0.8 -> 0.800000
image/gif Quality: 0.2 -> 0.200000
*/* Quality: 0.1 -> 0.100000
compress Quality: 0.9 -> 0.900000
en Quality: 0.66 -> 0.660000
fr Quality: 0.33 -> 0.330000
utf-8 Quality: 0.66 -> 0.660000
* Quality: 0.66 -> 0.660000

(value before '->' is string passed as argument for atof function, value after -
is a value returned by atof)

Buf after i get 406 (Not Acceptable) it look like
text/html Quality: 0.9 -> 0,000000
text/plain Quality: 0.8 -> 0,000000
image/gif Quality: 0.2 -> 0,000000
*/* Quality: 0.1 -> 0,000000
compress Quality: 0.9 -> 0,000000
en Quality: 0.66 -> 0,000000
fr Quality: 0.33 -> 0,000000
utf-8 Quality: 0.66 -> 0,000000
* Quality: 0.66 -> 0,000000

If i change atof call at line 392 for this function:

static float ap_atoq(const char *str) {
  float result1 = atof(str);
  float result2 = 0.0;
  char *p = strchr(str, '.'), *d;
  
  if (p != NULL) {
    *p = ',';
    result2 = atof(str);
  } else {
    d = strchr(str, ',');
    if (d != NULL) {
      *d = '.';
      result2 = atof(str);
    }
  }
  if (result2 > result1) return result2;
  return result1;
}

it seems all work fine.

Probably, httpd-2.0 is also affected.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message