From:             fcartegnie at nordnet dot fr
Operating system: Linux
PHP version:      4.3.6
PHP Bug Type:     Zlib Related
Bug description:  [PATCH] Allow gzopen for URL

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 bug report at http://bugs.php.net/?id=29045&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29045&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29045&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29045&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29045&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29045&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29045&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29045&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29045&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29045&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29045&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29045&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29045&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29045&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29045&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29045&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29045&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29045&r=float

Reply via email to