[PHP-DOC] #29045 [Sus]: gzopen for URL

2004-07-08 Thread helly
 ID:   29045
 Updated by:   [EMAIL PROTECTED]
 Reported By:  fcartegnie at nordnet dot fr
 Status:   Suspended
 Bug Type: Documentation problem
-Operating System: Linux
+Operating System: *
-PHP Version:  4.3.6
+PHP Version:  4.3.7
 Assigned To:  pollita
 New Comment:

You cannot drop STREAM_MUST_SEEK because the handler uses
seek. In case of http or ftp or what ever forward streams a temporary
file is created automatically so it still works as expected.


Previous Comments:


[2004-07-07 22:17:42] [EMAIL PROTECTED]

Wez needs to chime in on this...  

I stated that it wouldn't work for http (with or without the patch)
because I thought we had disabled shrinking the chunk_size to 1 while
reading into the HTTP headers (for performance reasons).  Looking back
at the code I see that the temporary shift into small chuck sizes *IS*
enabled when the STREAM_WILL_CAST flag is set (which it is for the zlib
fopen wrapper).

Maybe it was the conditional set based on the option flag that was the
compromise... in which case I'd say: Go ahead and use
fopen('compress.zlib://http://blah...',... but the patch provided for
gzopen() seems completely unnecessary.





[2004-07-07 16:16:46] [EMAIL PROTECTED]

compress.zlib://http://host.file.gz should work fine in php 4, not?

include compress.zlib://file.php.gz; works too ;-)



[2004-07-07 16:12:31] [EMAIL PROTECTED]

compress.zlib://host/path isn't actually valid.

What is valid however (as of PHP5) is:

$fp = fopen('http://host/path/file.gz', 'r');
/* Maybe a small fread() here to consume gzip headers, I don't recall
if they're sent with deflated content */
stream_filter_append($fp, 'zlib.inflate');

Note: For PHP 5.0 you need PECL package zlib_filter, it'll be rolled
into the core in PHP 5.1 .

The patch supplied above needs further review as I see a big potential
for zlib stream errors with the read buffer blocks that come in with
the headers.



[2004-07-07 14:39:51] fcartegnie at nordnet dot fr

compress.zlib://http:// seems to work

Maybe we could add some deprecation/pointer info in the documentation
of gzopen()

Changing for documentation problem



[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 ?



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/29045

-- 
Edit this bug report at http://bugs.php.net/?id=29045edit=1


[PHP-DOC] #29045 [Sus]: gzopen for URL

2004-07-07 Thread derick
 ID:   29045
 Updated by:   [EMAIL PROTECTED]
 Reported By:  fcartegnie at nordnet dot fr
 Status:   Suspended
 Bug Type: Documentation problem
 Operating System: Linux
 PHP Version:  4.3.6
 Assigned To:  pollita
 New Comment:

compress.zlib://http://host.file.gz should work fine in php 4, not?

include compress.zlib://file.php.gz; works too ;-)


Previous Comments:


[2004-07-07 16:12:31] [EMAIL PROTECTED]

compress.zlib://host/path isn't actually valid.

What is valid however (as of PHP5) is:

$fp = fopen('http://host/path/file.gz', 'r');
/* Maybe a small fread() here to consume gzip headers, I don't recall
if they're sent with deflated content */
stream_filter_append($fp, 'zlib.inflate');

Note: For PHP 5.0 you need PECL package zlib_filter, it'll be rolled
into the core in PHP 5.1 .

The patch supplied above needs further review as I see a big potential
for zlib stream errors with the read buffer blocks that come in with
the headers.



[2004-07-07 14:39:51] fcartegnie at nordnet dot fr

compress.zlib://http:// seems to work

Maybe we could add some deprecation/pointer info in the documentation
of gzopen()

Changing for documentation problem



[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.0 +0200
+++ php-4.3.6_perso/ext/zlib/zlib_fopen_wrapper.c   2004-07-07
12:23:34.0 +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=29045edit=1


[PHP-DOC] #29045 [Sus]: gzopen for URL

2004-07-07 Thread pollita
 ID:   29045
 Updated by:   [EMAIL PROTECTED]
 Reported By:  fcartegnie at nordnet dot fr
 Status:   Suspended
 Bug Type: Documentation problem
 Operating System: Linux
 PHP Version:  4.3.6
 Assigned To:  pollita
 New Comment:

Wez needs to chime in on this...  

I stated that it wouldn't work for http (with or without the patch)
because I thought we had disabled shrinking the chunk_size to 1 while
reading into the HTTP headers (for performance reasons).  Looking back
at the code I see that the temporary shift into small chuck sizes *IS*
enabled when the STREAM_WILL_CAST flag is set (which it is for the zlib
fopen wrapper).

Maybe it was the conditional set based on the option flag that was the
compromise... in which case I'd say: Go ahead and use
fopen('compress.zlib://http://blah...',... but the patch provided for
gzopen() seems completely unnecessary.




Previous Comments:


[2004-07-07 16:16:46] [EMAIL PROTECTED]

compress.zlib://http://host.file.gz should work fine in php 4, not?

include compress.zlib://file.php.gz; works too ;-)



[2004-07-07 16:12:31] [EMAIL PROTECTED]

compress.zlib://host/path isn't actually valid.

What is valid however (as of PHP5) is:

$fp = fopen('http://host/path/file.gz', 'r');
/* Maybe a small fread() here to consume gzip headers, I don't recall
if they're sent with deflated content */
stream_filter_append($fp, 'zlib.inflate');

Note: For PHP 5.0 you need PECL package zlib_filter, it'll be rolled
into the core in PHP 5.1 .

The patch supplied above needs further review as I see a big potential
for zlib stream errors with the read buffer blocks that come in with
the headers.



[2004-07-07 14:39:51] fcartegnie at nordnet dot fr

compress.zlib://http:// seems to work

Maybe we could add some deprecation/pointer info in the documentation
of gzopen()

Changing for documentation problem



[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?



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/29045

-- 
Edit this bug report at http://bugs.php.net/?id=29045edit=1