Re: http streams can't be filtered?
| From: | Wez Furlong | Date: | Thu, 06 Feb 2003 16:16:55 +0000 |
| Subject: | Re: http streams can't be filtered? | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-94064@lists.php.net to get a copy of this message | ||
It should not happen, and there is code in the http opener that *should*
avoid this, because it has negative implications for including files via
http.
I will take a look when I have more time...
--Wez.
On Wed, 5 Feb 2003, Sara Golemon wrote:
> Wez,
>
> After our short discussion in IRC today I decided to try and put together
> a simple implementation of that filter wrapper. What I came up with can be
> seen here:
> http://frankenbox.alphaweb.net/test/php.filter.diff.txt but
> it's
> not something I'm suggesting be commited, just a quick exercise to open my
> brain to thinking about implications... There's also the fact it's working
> on the current single filter chain model rather than the asymetric filter
> chains you've got planned.
>
> Now, the point I've managed to completely skirt around.... I discovered
> something a little disturbing about the http wrapper (and presumably other
> network wrappers as well). The following script (with or without the above
> patch applied) will *NOT* uppercase the content retrieved from the url
> because the content is read into buffer immediately (on the fopen call) and
> the filter isn't applied until the next line.
>
> <?php
> $fp = fopen("http://www.php.net/", "r");
> /* the data is already sitting in buffer */
> stream_filter_append($fp, "string.toupper");
> while ($str = fgets($fp))
> print $str;
> fclose($fp);
> ?>
>
> Presumably you're aware of this?
>
> -Pollita
>
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>