Ticket #88 (accepted defect)

Opened 9 years ago

Last modified 5 years ago

Accept-Encoding: gzip;q=0, deflate

Reported by: dartar Owned by: DotMG
Priority: normal Milestone: 1.4
Component: core Version:
Severity: normal Keywords: compression header encoding


(reported by DotMG)

Not really bug, but should be corrected for respect & compliance to RFC2616

If a browser sends the header

Accept-Encoding: gzip;q=0, deflate

Which should be interpreted as : "I don't support gzip encoding, but I prefer deflate", Wikka will understand "The browser supports gzip-encoding", as it just searches for the text gzip in $_SERVERHTTP_ACCEPT_ENCODING?. An example I use to treat it correctly is :

function ParseHeaderLine($hl, $token=null)
  $ar_hl = explode(',', $hl);
  foreach ($ar_hl as $dotmg_idx => $val)
   if (preg_match('/^\s*(.*?);\s*q\s*=\s*([0-9\.]*)/i', $val, $match))
	$res[strtolower($match[1])] = doubleval($match[2]);
	$res[strtolower($val)] = 1;
  if ($token) return(isset($res[$token]) && ($res[$token] > 0)); #if $token is set, we return true or false
  return ($res); # else we return the header parsed.


if ($this->ParseHeaderLine($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ...

Note : This function might be useful to deal also with Accept-Language, when Wikka will be made effectively multilingual. --DotMG

Change History

Changed 8 years ago by DarTar

  • milestone changed from to

Changed 8 years ago by DotMG

  • owner changed from unassigned to DotMG
  • status changed from new to assigned
  • milestone changed from 1.1.7 to

Not for this release again.

Changed 5 years ago by BrianKoontz

  • milestone changed from 1.2.1 to 1.3

Changed 5 years ago by BrianKoontz

  • milestone changed from 1.3 to 1.4
Note: See TracTickets for help on using tickets.