Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChunkedBody decoding with Curl Adapter #25

Closed
weierophinney opened this issue Dec 31, 2019 · 7 comments
Closed

ChunkedBody decoding with Curl Adapter #25

weierophinney opened this issue Dec 31, 2019 · 7 comments

Comments

@weierophinney
Copy link
Member

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


Originally posted by @necromant2005 at zendframework/zend-http#19

@weierophinney
Copy link
Member Author

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.


Originally posted by @zerocrates at zendframework/zend-http#19 (comment)

@weierophinney
Copy link
Member Author

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.


Originally posted by @zerocrates at zendframework/zend-http#19 (comment)

@weierophinney
Copy link
Member Author

Any idea when this would be fixed?


Originally posted by @sgehrig at zendframework/zend-http#19 (comment)

@weierophinney
Copy link
Member Author

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


Originally posted by @necromant2005 at zendframework/zend-http#19 (comment)

@weierophinney
Copy link
Member Author

Who is the current maintainer of Zend\Http?


Originally posted by @sgehrig at zendframework/zend-http#19 (comment)

@weierophinney
Copy link
Member Author

I suppose that's @weierophinney


Originally posted by @necromant2005 at zendframework/zend-http#19 (comment)

@weierophinney
Copy link
Member Author

This package is considered feature-complete, and is now in security-only maintenance mode, following a decision by the Technical Steering Committee.
If you have a security issue, please follow our security reporting guidelines.
If you wish to take on the role of maintainer, please nominate yourself

You can continue using laminas/laminas-http safely.
Its successor will be PSR-7 in a later revision of laminas/laminas-mvc.

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

No branches or pull requests

1 participant