diff options
| author | Stefan Roehrich <sr@php.net> | 2003-08-24 13:59:34 +0000 |
|---|---|---|
| committer | Stefan Roehrich <sr@php.net> | 2003-08-24 13:59:34 +0000 |
| commit | aa632187cd869dad09369f0b3200a1b75c8fe26e (patch) | |
| tree | 6857194bfcf75aafdb56d8f7b96d9abcbc13593b /ext/zlib | |
| parent | 8828e17a4461653ddd0d667c0598292b5ef5f8df (diff) | |
| download | php-git-aa632187cd869dad09369f0b3200a1b75c8fe26e.tar.gz | |
Fixed bug #25218 ("deflate" compressed pages had a gzip header, which
should only be sent with "gzip" compressed pages).
Diffstat (limited to 'ext/zlib')
| -rw-r--r-- | ext/zlib/zlib.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 752601414e..e700270cb2 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -702,7 +702,7 @@ static int php_do_deflate(uint str_length, Bytef **p_buffer, uint *p_buffer_len, 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 @@ static int php_deflate_string(const char *str, uint str_length, char **newstr, u 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 @@ static int php_deflate_string(const char *str, uint str_length, char **newstr, u *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 */ |
