ID: 29045
User updated by: fcartegnie at nordnet dot fr
-Summary: [PATCH] Allow gzopen for URL
Reported By: fcartegnie at nordnet dot fr
Status: Open
-Bug Type: Zlib Related
+Bug Type: Documentation problem
Operating System: Linux
PHP Version: 4.3.6
New Comment:
compress.zlib://http:// seems to work
Maybe we could add some deprecation/pointer info in the documentation
of gzopen()
Changing for documentation problem
Previous Comments:
------------------------------------------------------------------------
[2004-07-07 14:33:40] fcartegnie at nordnet dot fr
I did not see this syntax in the documentation.
fopen("compress.zlib://host.com/file.gz")
How would you specify HTTP or FTP ?
------------------------------------------------------------------------
[2004-07-07 13:09:46] [EMAIL PROTECTED]
Why not use fopen("compress.zlib://host.com/file.gz") and all the other
normal file operations?
------------------------------------------------------------------------
[2004-07-07 12:38:02] fcartegnie at nordnet dot fr
Description:
------------
Current Zlib wrapper does not allow using gzopen()
on remote URL.
results in a "cannot make seekable" error (from streams.c)
Seems a bug reopen.
Patch attached.
Reproduce code:
---------------
gzopen("http://aaa/truc.gz", "r");
Expected result:
----------------
diff -u php-4.3.6/ext/zlib/zlib_fopen_wrapper.c
php-4.3.6_perso/ext/zlib/zlib_fopen_wrapper.c
--- php-4.3.6/ext/zlib/zlib_fopen_wrapper.c 2003-07-24
02:03:51.000000000 +0200
+++ php-4.3.6_perso/ext/zlib/zlib_fopen_wrapper.c 2004-07-07
12:23:34.000000000 +0200
@@ -97,6 +97,7 @@
{
struct php_gz_stream_data_t *self;
php_stream *stream = NULL, *innerstream = NULL;
+ int seekoption;
/* sanity check the stream: it can be either read-only or write-only
*/
if (strchr(mode, '+')) {
@@ -113,7 +114,12 @@
else if (strncasecmp("zlib:", path, 5) == 0)
path += 5;
- innerstream = php_stream_open_wrapper(path, mode,
STREAM_MUST_SEEK|options|STREAM_WILL_CAST, opened_path);
+ if ( (strncasecmp("http://", path, 7) == 0) || (strncasecmp("ftp://",
path, 6) == 0) )
+ {
+ seekoption = 0;
+ } else seekoption = STREAM_MUST_SEEK;
+
+ innerstream = php_stream_open_wrapper(path, mode,
seekoption|options|STREAM_WILL_CAST, opened_path);
if (innerstream) {
int fd;
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29045&edit=1