RE: [PEAR-DEV] patch to HTTP/Request.php for proper chunked content handling
| From: | David Sklar | Date: | Fri, 08 Mar 2002 19:42:01 +0000 |
| Subject: | RE: [PEAR-DEV] patch to HTTP/Request.php for proper chunked content handling | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-4946@lists.php.net to get a copy of this message | ||
Oops. Sorry about the patch-attachment issues. Here's the patch (with
bad-linebreaking apologies in advance):
--- Request.php.orig Fri Mar 8 13:10:56 2002
+++ Request.php Fri Mar 8 13:12:26 2002
@@ -477,12 +477,11 @@
$chunksize = hexdec($matches[1]);
if ($chunksize > 0) {
$chunks[] = substr($body, 0, $chunksize);
- $body = substr($body, 0, $chunksize + 2); // Plus
trailing CRLF
+ $body = substr($body, $chunksize + 2,
strlen($body)); // After trailing CRLF to end
} else {
break;
}
} else {
- pdd($line);
break;
}
}
-dave
> -----Original Message-----
> From: Richard Heyes [mailto:richard@phpguru.org]
> Sent: Friday, March 08, 2002 2:19 PM
> To: David Sklar
> Cc: Pear-Dev
> Subject: RE: [PEAR-DEV] patch to HTTP/Request.php for proper chunked
> content handling
>
>
> > HTTP/Request.php does not stitch together received pieces of
> > chunked content
> > properly. Instead of moving from chunk to chunk in the response
> > body, it was
> > taking repeated substrings from the beginning of the body. Attached is a
> > patch that fixes this. It also removes the call to the pdd() debugging
> > function, which someone brought up in a previous message.
>
> No patch attached. :(
>
> > Because it uses substr() and strlen(), I'm not sure if this
> patch (or the
> > original code in HTTP/Request.php) is binary-safe (i.e. if there
> > are ASCII 0
> > characters in the response body.) Does anyone have any thoughts
> > about that?
>
> substr() and strlen() are binary safe.
>
> --
> Richard Heyes
> "If you have any trouble sounding condescending,
> find a Unix user to show you how it's done." - Scott Adams