Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40306 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29830 invoked from network); 6 Sep 2008 22:19:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Sep 2008 22:19:07 -0000 Authentication-Results: pb1.pair.com header.from=prf.kishorekumar@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=prf.kishorekumar@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.44.28 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: prf.kishorekumar@gmail.com X-Host-Fingerprint: 74.125.44.28 yx-out-2324.google.com Received: from [74.125.44.28] ([74.125.44.28:21487] helo=yx-out-2324.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FC/64-12247-AD103C84 for ; Sat, 06 Sep 2008 18:19:07 -0400 Received: by yx-out-2324.google.com with SMTP id 3so543989yxj.83 for ; Sat, 06 Sep 2008 15:19:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:mime-version:content-type:x-google-sender-auth; bh=3sdORHvNVOjmhhm5PmoKQEyLcYCC/W4MZzVLbMKAyUE=; b=vLBSd5GdQ81e7wji8cmORmBqd2VV5Q5PvsznRHzntX8dutO+aV+GkegT6B9XYgRs5c B0CEOHlp2tfV0IFyeNeEV1+XT7160eK/fyA9XVg6FQWrGRlYtLtlOkVNdExmhsICWeBE jbe6xqKNKcMjnP+b2ZSsUU5JjR6mjNvOH2jpk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:mime-version:content-type :x-google-sender-auth; b=QoiwHoi2ZXJcv/WqTt5lfE9ikdS8h2UOo5R4/HimKSGP7x6p87C+fYKQeuv3lDr4wV Cn5XpcWk1SxKLQSGBEYkgYHqnYqFJQV4TGXCxcbVB5i/5Tyk9heDqzdp8jl0dzRav7Go uE7QYxbplR3QH/XY3I15+UkdZ3EnInZMWCm0w= Received: by 10.150.147.9 with SMTP id u9mr18844930ybd.186.1220739544317; Sat, 06 Sep 2008 15:19:04 -0700 (PDT) Received: by 10.151.105.15 with HTTP; Sat, 6 Sep 2008 15:19:04 -0700 (PDT) Message-ID: Date: Sun, 7 Sep 2008 03:49:04 +0530 Sender: prf.kishorekumar@gmail.com To: "PHP Internals" MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_83814_32624330.1220739544334" X-Google-Sender-Auth: 635e8bca80a729d3 Subject: Strange problem with php_stream_read() From: mangol.smith@gmail.com ("Mangol Smith") ------=_Part_83814_32624330.1220739544334 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 ------=_Part_83814_32624330.1220739544334--