Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

ChunkedBody decoding with Curl Adapter #19

Open
necromant2005 opened this issue Aug 27, 2015 · 7 comments
Open

ChunkedBody decoding with Curl Adapter #19

necromant2005 opened this issue Aug 27, 2015 · 7 comments

Comments

@necromant2005
Copy link

Zend\Http\Response::decodeChunkedBody fail with exception when curl adapter decode body itself , BUT it still has "Transfer-Encoding: encoded" header

$client = new \Zend\Http\Client();
$client->setOptions(array( 
   'sslverifypeer' => false,
   'adapter'         => 'Zend\Http\Client\Adapter\Curl',
));
$client->setUri('https://www.truesocialmetrics.com/');
$response = $client->send(); // Error parsing body - doesn't seem to be a chunked message

php: 5.5 , 5.6, 7

@zerocrates
Copy link
Contributor

It looks like you're leaving off the $response->getBody() call that would actually cause the exception.

At any rate, in this case, it looks like the problem is that the server you're talking to sends the header in lowercase: transfer-encoding: chunked, while the code in the curl adapter that's supposed to deal with this (line 437) only looks for the uppercase version.

Header names are case-insensitive by definition, and the values for Transfer-Encoding are also case-insensitive, so just adding the i case-insensitivity flag to the regex being used here is probably a reasonable solution.

@zerocrates
Copy link
Contributor

This would be fixed by the open PR #10, and this issue serves as an example of the kind of bug that currently happens and that PR would fix.

Specifically, this looks like a regression introduced by ddf5a83: the comparisons were case-sensitive at that point, and when adding support for varying whitespace, the insensitivity was accidentally not applied to the new regex version of the code.

@sgehrig
Copy link
Contributor

sgehrig commented May 3, 2016

Any idea when this would be fixed?

@necromant2005
Copy link
Author

Nope. I've patched zend to solve this issue.

@sgehrig
Copy link
Contributor

sgehrig commented May 3, 2016

Who is the current maintainer of Zend\Http?

@necromant2005
Copy link
Author

I suppose that's @weierophinney

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas/laminas-http; a new issue has been opened at laminas/laminas-http#25.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants