content_size, 1); if you know the length.
Scott
On 6 Sep 2008, at 23:19, Mangol Smith wrote:
> Hello all,
>
> I got a strange problem. I opened a network stream with my web server
> (localhost:80) and wrote a HTTP GET into stream and reading the HTTP
> RESPONSE.
>
> buff = (char *)emalloc(content_size);
> php_stream_read(http_stream, buff, content_size);
>
> where content_size is the Content-Length value in Response header.
> Problem
> is that when I return RETURN_STRING(buff,1); to userland. I'm
> getting a
> string with the content (response body) + some crap.
>
> length of string is more than content_size.
>
> for example: in a case content_size was 29; after php_stream_read()
> line,
> the strlen(buff) is returning 41. How is this possible?
>
> somewhere I read this
>
> php_stream_read() differs from other stream read functions in one
> surprising
> way. If the stream in use is not a plain files stream, only one call
> to the
> underlying stream implementation's read function will be made, even
> if more
> data was requested and more is actually available to return. This is a
> compromise to let packet-based protocols such as UDP function cleanly
> without blocking.
>
> I didn't clearly understand its meaning. Does it has anything to do
> with my
> results? Any help in understanding this behavious of
> php_stream_read() ?
>
>
>
> --
> Mangol Smith
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
No comments:
Post a Comment