[users@httpd] mod_deflate mangles 304 responses from PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I have a problem with mod_deflate. If deflate is enabled, 304 responses from
PHP are returned with some binary body data, which is in violation of
RFC2616 (304 response must have no body), and breaks pipelining/keep-alive.

Here is a simple test:
http://pp.siedziba.pl/tmp/ifmodifiedtest.php

Reload the page in a browser with some sniffer running, or just telnet to
the server and send Accept-Encoding and If-Modified headers like this:

$ telnet pp.siedziba.pl 80
Trying 213.25.55.158.80...
Connected to pp158.warszawa.sdi.tpnet.pl.
Escape character is '^]'.
GET /tmp/ifmodifiedtest.php HTTP/1.1
Host: pp.siedziba.pl
Accept-Encoding: gzip,deflate
If-Modified-Since: Sat, 14 Apr 2001 20:00:36 GMT

Binary data after the response may not be visible in a shell, so it may be a
good idea to redirect the output to a file.

I tested it with Apache 2.0.(53|54) and PHP 5.0.(3|4) (mod_php, compiled as
a handler). More details about my system:
http://pp.siedziba.pl/tmp/phpinfo.php

To work-around this problem, I added a simple check to mod_deflate.c:
(...)
            return ap_pass_brigade(f->next, bb);
        }

        /* don't work on responses which must have no content */
        if (r->status == HTTP_NOT_MODIFIED || r->status == HTTP_NO_CONTENT)
        {
            ap_remove_output_filter(f);
            return ap_pass_brigade(f->next, bb);
        }

        /* some browsers might have problems, so set no-gzip
         * (with browsermatch) for them
         */
        if (apr_table_get(r->subprocess_env, "no-gzip")) {
(...)

It seems to work, as seen here:
http://biuro.siedziba.pl/tmp/ifmodifiedtest.php
(same test script, different server)
I don't know if this is a proper solution though.

Is it a known issue? Anyone else experiencing this problem?

Regards,
-- 
 Piotr Pawłow
 mailto:pp@xxxxxxxxxxx


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux