From a9e47b31f012d8338873cc6eec8f724a3d750088 Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Fri, 30 Nov 2001 03:59:21 +0000 Subject: [PATCH] Merge in Edd Dumbill's changes to header parsing in release 1.02 of xmlrpc for php; Now allows whitespace in the xml itself --- phpgwapi/inc/class.xmlrpcmsg.inc.php | 32 +++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/phpgwapi/inc/class.xmlrpcmsg.inc.php b/phpgwapi/inc/class.xmlrpcmsg.inc.php index 2d5cd08804..181434d436 100644 --- a/phpgwapi/inc/class.xmlrpcmsg.inc.php +++ b/phpgwapi/inc/class.xmlrpcmsg.inc.php @@ -154,13 +154,35 @@ xml_parser_free($parser); return $r; } - // gotta get rid of headers here - if ((!$hdrfnd) && ereg("^(.*)\r\n\r\n",$data,$GLOBALS['_xh'][$parser]['ha'])) + + // if using HTTP, then gotta get rid of HTTP headers here + // and we store them in the 'ha' bit of our data array + if (ereg("^HTTP", $data)) { - $data = ereg_replace("^.*\r\n\r\n", "", $data); - $hdrfnd = 1; + $ar=explode("\r\n", $data); + $newdata = ''; + $hdrfnd = 0; + for ($i=0; $i0) + { + $GLOBALS['_xh'][$parser]['ha'] .= $ar[$i]. "\r\n"; + } + else + { + $hdrfnd=1; + } + } + else + { + $newdata.=$ar[$i] . "\r\n"; + } + } + $data=$newdata; } - + if (!xml_parse($parser, $data, sizeof($data))) { // thanks to Peter Kocks