Skip Menu |

This queue is for tickets about the POE-Component-Client-HTTP CPAN distribution.

Report information
The Basics
Id: 13973
Status: resolved
Worked: 30 min
Priority: 0/
Queue: POE-Component-Client-HTTP

People
Owner: RCAPUTO [...] cpan.org
Requestors: tech [...] askold.net
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Workaround for incorrect chunked responses
Hello Some servers, for example Yahoo send chunk lenght contrary to RFC. This is the lenght part of chunked packet from yahoo: "753e \r\n" It has spaces between number in hex and CRLF. This is not by RFC, but better to add workaround for such case (currently length is not matched by Filter/HTTPChunk.pm and whole body is ignored). I'm proposing to change one line in Filter/HTTPChunk.pm from: 94 if ($chunk =~ s/^($HEX+)(?:;.*)?\015?\012//s) { to: 94 if ($chunk =~ s/^($HEX+)(?:;.*?)\s*?\015?\012//s) { There are two changes. 1. Match possible spaces before CRLF 2. Use non greedy matching for chunk-extensions (because if extensions are used and body contains CRLF part of body can truncated) Please apply this fix. Spaces does not conform RFC, however better to have such workaround. Thank you in advance.
[YKAR - Tue Aug 2 07:35:08 2005]: Oops I mada a typo (inserted a \s* in a wrong place), here is the correct change: from: 94 if ($chunk =~ s/^($HEX+)(?:;.*)?\015?\012//s) { to: 94 if ($chunk =~ s/^($HEX+)(?:;.*?)?\s*\015?\012//s) { Show quoted text
> Hello > > Some servers, for example Yahoo send chunk lenght contrary to RFC. > This is the lenght part of chunked packet from yahoo: > > "753e \r\n" > > It has spaces between number in hex and CRLF. This is not by RFC, but > better to add workaround for such case (currently length is not > matched by Filter/HTTPChunk.pm and whole body is ignored). > > I'm proposing to change one line in Filter/HTTPChunk.pm > from: > 94 if ($chunk =~ s/^($HEX+)(?:;.*)?\015?\012//s) { > to: > 94 if ($chunk =~ s/^($HEX+)(?:;.*?)\s*?\015?\012//s) { > > There are two changes. > > 1. Match possible spaces before CRLF > 2. Use non greedy matching for chunk-extensions (because if extensions > are used and body contains CRLF part of body can truncated) > > Please apply this fix. Spaces does not conform RFC, however better to > have such workaround. > > Thank you in advance.
Fix committed as revision 200. Thank you for tracking this down. The final line reads: if ($chunk =~ s/^($HEX+)(?:;.*?)?[^\S\015\012]*\015?\012//s) { I changed your fix because it caused a test to fail. I don't want to sound unappreciative, but it would be helpful if you could test your fixes before submitting them. Thank you again. I had no idea this was the cause of the problem, so it would have gone unfixed without your report.