I'm stuck on this issue with DHL on Magento 1.7.1 :
Symptoms:
- If I use the test DHL API url I got the a correct response from DHL (https://xmlpitest-ea.dhl.com/XMLShippingServlet)
- if I use the production DHL API url (https://xmlpi-ea.dhl.com/XMLShippingServlet) the XML request is correctly created by Magento but I got no XML response from DHL.
Details:
- DHL response is empty
- an exception is trigger by and cached in
Zend_Http_Response
(579) and then caught inMage_Usa_Model_Shipping_Carrier_Dhl_International
(849):
Error parsing body – doesn't seem to be a chunked message
I contacted DHL but they say everything is correct on their side.
Any one is experiencing same problem ? what I should check ?
Thanks you in advance
Best Answer
As for question description this is a problem related to Magento < 1.8 and the fix is contained in this class
Varien_Http_Adapter_Curl
Solution:
Just copy this file
lib/Varien/Http/Adapter/Curl.php
from Magento 1.8.1 inapp/code/local/Varien/Http/Adapter/Curl.php
Details:
Debugging Zend/Http/Reponse.php (
Zend_Http_Response
) and the response Header, I have found out that there is a difference in the processed response.Response Header for on 1.8.1
Response Header for on 1.7.0.2
The main difference here is the presence of
Transfer-Encoding: chunked
.This is causing
Zend_Http_Response
to usedecodeChunkedBody()
method that finally trigger an exception:-- Error parsing body - doesn't seem to be a chunked message
Now it is not clear to me if this is bug in Zend/Varien because it looks more a bug in the DHL response. ( if we use DHL Test API URL the response doesn't contains the guilty header entry )
If you look
read()
method inVarien_Http_Adapter_Curl
( that is the only changed method in respect to Magento 1.7.1 version ) you will see Varien team has workarounded the issue just cleaning the header form that entry.