php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51898 ob_gzhandler doesn't check support for gzip encoding properly
Submitted: 2010-05-24 14:18 UTC Modified: 2013-07-30 19:49 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: dom at w3 dot org Assigned: mike (profile)
Status: Wont fix Package: Zlib related
PHP Version: 5.3.2 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dom at w3 dot org
New email:
PHP Version: OS:

 

 [2010-05-24 14:18 UTC] dom at w3 dot org
Description:
------------
ob_start(ob_gzhandler) can be used to send optionally compressed-output to clients.

But the test made to check whether the client supports gzip/deflate encoding only looks at the appearance of the string "gzip" (resp. "deflate") in the Accept-Encoding header, but doesn't actually parse the said header.

This means that the following Accept-Encoding headers will trigger generation of gzip-compressed output when they should not:
* using a string with gzip in it 
Accept-Encoding: foogzip25
* using quality parameters as made possible in HTTP
Accept-Encoding: gzip;q=0, identity;q=1 


Test script:
---------------
<?php
if (!ob_start("ob_gzhandler")) {
  ob_start();
  echo "Uncompressed";
} else {
  echo "Compressed";
}
ob_end_flush();
?>

Expected result:
----------------
The script below can be used to test with the accept-encoding reported above; the said accept-encoding should report "Uncompressed" but reports "Compressed" (gzipped).



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-19 14:44 UTC] mike@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: mike
 [2013-07-30 19:49 UTC] mike@php.net
-Status: Verified +Status: Wont fix -Package: Output Control +Package: Zlib related
 [2013-07-30 19:49 UTC] mike@php.net
I'd suggest using pecl/http or mod_deflate for a more sophisticated check.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 15:01:32 2024 UTC