sr              Sun Aug 24 09:59:35 2003 EDT

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/zlib   zlib.c 
  Log:
  Fixed bug #25218 ("deflate" compressed pages had a gzip header, which
  should only be sent with "gzip" compressed pages).
  
  
Index: php-src/NEWS
diff -u php-src/NEWS:1.1461 php-src/NEWS:1.1462
--- php-src/NEWS:1.1461 Thu Aug 21 20:14:21 2003
+++ php-src/NEWS        Sun Aug 24 09:59:34 2003
@@ -44,6 +44,7 @@
 - Fixed bug #19859 (allow fast_call_user_function to support __call). 
   (Stanislav)
 - Fixed bug #17988 (strtotime failed to parse postgresql timestamp). (Derick)
+- Fixed bug #25218 ("deflate" compressed pages had a gzip header). (Stefan)
 
 29 Jun 2003, PHP 5 Beta 1 
 - Removed the bundled MySQL client library. (Sterling)
Index: php-src/ext/zlib/zlib.c
diff -u php-src/ext/zlib/zlib.c:1.176 php-src/ext/zlib/zlib.c:1.177
--- php-src/ext/zlib/zlib.c:1.176       Sun Aug 24 09:32:50 2003
+++ php-src/ext/zlib/zlib.c     Sun Aug 24 09:59:34 2003
@@ -19,7 +19,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: zlib.c,v 1.176 2003/08/24 13:32:50 sr Exp $ */
+/* $Id: zlib.c,v 1.177 2003/08/24 13:59:34 sr Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -702,7 +702,7 @@
        Bytef *buffer;
        uInt prev_outlen, outlen;
        int err;
-       int start_offset = (do_start ? 10 : 0);
+       int start_offset = ((do_start && ZLIBG(compression_coding) == CODING_GZIP) ? 
10 : 0);
        int end_offset = (do_end ? 8 : 0);
 
        outlen = (uint) (sizeof(char) * (str_length * 1.001f + 12) + 1); /* leave some 
room for a trailing \0 */
@@ -776,14 +776,14 @@
        ZLIBG(stream).next_in = (Bytef *) str;
        ZLIBG(stream).avail_in = (uInt) str_length;
 
-       if (ZLIBG(compression_coding) == 1) {
+       if (ZLIBG(compression_coding) == CODING_GZIP) {
                ZLIBG(crc) = crc32(ZLIBG(crc), (const Bytef *) str, str_length);
        }
 
        err = php_do_deflate(str_length, (Bytef **) newstr, new_length, do_start, 
do_end TSRMLS_CC);
        /* TODO: error handling (err may be Z_STREAM_ERROR, Z_BUF_ERROR, ?) */
 
-       if (do_start) {
+       if (do_start && ZLIBG(compression_coding) == CODING_GZIP) {
                /* Write a very simple .gz header: */
                (*newstr)[0] = gz_magic[0];
                (*newstr)[1] = gz_magic[1];
@@ -793,7 +793,7 @@
                *new_length += 10;
        }
        if (do_end) {
-               if (ZLIBG(compression_coding) == 1) {
+               if (ZLIBG(compression_coding) == CODING_GZIP) {
                        char *trailer = (*newstr) + (*new_length);
 
                        /* write crc & stream.total_in in LSB order */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to