phpxmlrpc icon indicating copy to clipboard operation
phpxmlrpc copied to clipboard

Problem with inflated

Open XharkTR opened this issue 6 years ago • 7 comments
trafficstars

For a request working fine in my coworkers pc, I'm getting Invalid return payload: enable debugging to examine incoming payload (XML error at line 1, check URL). Debug returns an INFLATED RESPONSE that i'm not able to get acces to, but it seems correct. but also I'm getting this:

---GOT---
HTTP/1.1 200 OK
Date: Thu, 07 Feb 2019 08:09:13 GMT
Server: Apache/2.4.18 (Ubuntu)
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 957
Connection: close
Content-Type: text/xml;charset=none

‹íkoÚ0†¿÷WDý´Jíb;@ʨ¢@i´*©¸ü€,¸m$’0'­¶?séE¹-£…œO`^|°ý>ãÈÖå¯x¡<q‘Eiòí”~%§—ý+æùC:ól™&—Ë@qöüD>>‹GÞ·!‚ß²8òàµ6ËÅc˜¯uâ\ô­$ˆyÿއ¥®Ÿ¿¼4Jò>#”–º*YêæÒ‰¥nßþNGð;.xF‰Éύ’û>a¬×3tBtKÝVUЦbΓ½1tÚ©¯Åóèç#Ï‹›G6Є֭/+ãÎây‘(5I‡„h€˜ËôzD'†	
ºRM>0bšDÓÅF¢$nF“–‰mÚ
ºR
---END---

HEADER: date: Thu, 07 Feb 2019 08:09:13 GMT
HEADER: server: Apache/2.4.18 (Ubuntu)
HEADER: vary: Accept-Encoding
HEADER: content-encoding: gzip
HEADER: content-length: 957
HEADER: connection: close
HEADER: content-type: text/xml;charset=none

XharkTR avatar Feb 07 '19 08:02 XharkTR

Hello. I fear that charset=none might confuse the client-side of the lib. However, that would most likely give a different error... One easy way to troubleshoot the problem is to enable/disable support for receiving compressed responses, via setting the corresponding flag in the client

gggeek avatar Feb 07 '19 10:02 gggeek

Doing $client->setAcceptedCompression("");i'm not getting the baddly codified string, but i'm still getting the same error... What trubbles me is taht i can see that im getting the responses but i dont know how to get it.

--GOT---
HTTP/1.1 200 OK
Date: Thu, 07 Feb 2019 11:09:01 GMT
Server: Apache/2.4.18 (Ubuntu)
Vary: Accept-Charset,Accept-Encoding
Content-Length: 174337
Connection: close
Content-Type: text/xml;charset=none

<?xml version="1.0"?>
<methodResponse>
<params>
<param>
<value><array>
<data>
<value><struct>
<member>
...
</member>
...

$res->faultCode() is true.

XharkTR avatar Feb 07 '19 11:02 XharkTR

This seems indeed to be a charset encoding problem then. Do you have a way to send me the response payload, in its binary form? Or could I access the server to examine the responses?

gggeek avatar Feb 07 '19 18:02 gggeek

Unfortunatyl I couldn't, since is protected information... How can i acces de binary form of the response payload?

(thanks for your help, btw)

XharkTR avatar Feb 08 '19 06:02 XharkTR

I thing the problem is here:

XharkTR avatar Feb 08 '19 09:02 XharkTR

I hitnk the problem might be here(xmlrpc.inc line 2630):

if (extension_loaded('mbstring')) {
    $data = mb_convert_encoding($data, 'UTF-8', $resp_encoding);
}

After that call to mb_convert_encoding, $data is not longer accesible.($resp_encodig is "NONE", ata that point).

EDIT: HOTFIX so i can keep working:

$data = mb_convert_encoding($data, 'UTF-8', 'gzip');

XharkTR avatar Feb 08 '19 09:02 XharkTR

gzip is not a valid value for mb_convert_encoding. Can you test instead if using 'auto' works? If so, I could think about adding some special-case code for when invalid charset declarations are found, such as in your case. Tbh, I think that you should rather fix the server so that it does not emit the charset encoding header at all instead of saying charset=none ...

gggeek avatar Feb 08 '19 11:02 gggeek

No feedback for over two years. Closing

gggeek avatar Oct 01 '22 15:10 gggeek