[phpxmlrpc] Extraneous charset in Content-length header

Jeff Barr jeff at vertexdev.com
Thu Aug 5 15:03:53 BST 2004

One of my users is reporting that my XML-RPC server is returning a bad 
header, like this:

Content-length: 321;charset=utf-8

Looking at function service in xmlrpcs.inc, I don't see how this could 
be happening. I confirmed that this is happening with the debug flag:

HEADER: Date: Thu, 05 Aug 2004 13:55:39 GMT
HEADER: Server: Apache/1.3.29 (Unix) PHP/4.3.6 mod_gzip/ mod_throttle/3.1.2
HEADER: X-Powered-By: PHP/4.3.6
HEADER: Connection: close
HEADER: Content-Type: text/xml
HEADER: Content-length: 4113;charset=utf-8

Is Apache inserting this text in an attempt to be helpful?

According to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html , 
charset= belongs on the Content-type header. As a hack, I changed
the service function to put the charset on Content-type, like this:

	Header("Content-type: text/xml;charset=utf-8\r\nContent-length: " .

And now it seems to be working fine.

Has anyone else had to deal with this?


* RSS Feeds:       http://www.syndic8.com
* Resume:          http://www.syndic8.com/~jeff/resume.html
* MSN IM:          jeffscottbarr at hotmail.com
* Developer Books: http://www.developer-books.com

More information about the phpxmlrpc mailing list