mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
The naming of the userland functions is terrible and confused me. gzdecode() is actually the function to decompress a gzip stream, and gzuncompress() is the one to decompress a deflate stream... See zlib.c to see the internal function -> type mapping.
This commit is contained in:
parent
88ff32a25b
commit
ce7ed6e040
2 changed files with 8 additions and 6 deletions
|
@ -1256,14 +1256,16 @@ try_again:
|
||||||
zval retval;
|
zval retval;
|
||||||
zval params[1];
|
zval params[1];
|
||||||
|
|
||||||
|
/* Warning: the zlib function names are chosen in an unfortunate manner.
|
||||||
|
* Check zlib.c to see how a function corresponds with a particular format. */
|
||||||
if ((strcmp(content_encoding,"gzip") == 0 ||
|
if ((strcmp(content_encoding,"gzip") == 0 ||
|
||||||
strcmp(content_encoding,"x-gzip") == 0) &&
|
strcmp(content_encoding,"x-gzip") == 0) &&
|
||||||
zend_hash_str_exists(EG(function_table), "gzuncompress", sizeof("gzuncompress")-1)) {
|
zend_hash_str_exists(EG(function_table), "gzdecode", sizeof("gzdecode")-1)) {
|
||||||
ZVAL_STRING(&func, "gzuncompress");
|
ZVAL_STRING(&func, "gzdecode");
|
||||||
ZVAL_STR_COPY(¶ms[0], http_body);
|
ZVAL_STR_COPY(¶ms[0], http_body);
|
||||||
} else if (strcmp(content_encoding,"deflate") == 0 &&
|
} else if (strcmp(content_encoding,"deflate") == 0 &&
|
||||||
zend_hash_str_exists(EG(function_table), "gzinflate", sizeof("gzinflate")-1)) {
|
zend_hash_str_exists(EG(function_table), "gzuncompress", sizeof("gzuncompress")-1)) {
|
||||||
ZVAL_STRING(&func, "gzinflate");
|
ZVAL_STRING(&func, "gzuncompress");
|
||||||
ZVAL_STR_COPY(¶ms[0], http_body);
|
ZVAL_STR_COPY(¶ms[0], http_body);
|
||||||
} else {
|
} else {
|
||||||
efree(content_encoding);
|
efree(content_encoding);
|
||||||
|
|
|
@ -32,8 +32,8 @@ function test($compressed_response, $compression_name) {
|
||||||
http_server_kill($pid);
|
http_server_kill($pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
test(gzcompress($plain_response), "gzip");
|
test(gzencode($plain_response), "gzip");
|
||||||
test(gzdeflate($plain_response), "deflate");
|
test(gzcompress($plain_response), "deflate");
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
int(7)
|
int(7)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue