PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Web Services » Services_Amazon » Bug #7237

Chunked HTTP Reponse not supported

Details

Submitted2006-03-29 08:41 UTC
Fromjbruyndonckx at telenet dot be
Assignedttsuruoka
StatusNo Feedback
PackageServices_Amazon
PHP Version5.1.2
OSWindows XP
Roadmaps(Not assigned)

Comments

[2006-03-29 08:41 UTC] jbruyndonckx at telenet dot be

Description:
------------
Hi,

The Amazon Service can return the response in chunks. This is (currently) not supported by HTTP_Request.
An easy fix is to go back to HTTP/1.0.

In AmazonECS4.php, line 928:

$http = &new HTTP_Request($url);
$http->setHttpVer ('1.0') ; /////////
$http->addHeader('User-Agent', 'Services_AmazonECS4/' . $this->getApiVersion());
$http->sendRequest();

Test script:
---------------
$options = array();
$options['Operation'] = 'ItemSearch';
$options['Artist'] = 'Jem';
$options['SearchIndex'] = 'Music';
$options['ResponseGroup'] = 'Small,BrowseNodes';
$options['Sort'] = 'orig-rel-date';
$options['ItemPage'] = 1 ;
$options['locale'] = 'us' ;
$result = $this->_sendRequest($options);
print_r ($result) ;

The data cannot be unserialised, but it is incomplete. It's incomplete because only the first chunk is read...

[2006-03-29 17:56 UTC] ttsuruoka at php dot net

Thank you for reporting!

I have tested the script, and it works fine for me.
Why?

[2006-03-30 12:23 UTC] jbruyndonckx at telenet dot be

Hmm, no idea.
Is it possible you don't use the latest HTTP_Request class?
I saw in the http sniffer that the data comes back in
chunks and that thus only the first 32K was present in the
responsebody. Hence the XML unserializer chocked on it...