Here is the patch that will fix xmlrpc.inc to work with large
payloads. Not sure how large, but certainly larger than the original
version. Hope you don't mind the verbose comments...

-jason

*** xmlrpc.inc  Fri Aug 24 21:48:10 2001
--- /home/jason/src/xmlrpc/xmlrpc.inc   Fri Jul  6 11:23:35 2001
*************** class xmlrpcmsg {
*** 556,603 ****
                return $r;
        }
        // gotta get rid of headers here
!       // From the looks of it, the ereg and ereg_replace methods
!       // will not work on any buffers that are > 20kbytes.
!       // so instead we'll use preg_split and preg_match. When we're done,
!       // we need to leave the header-less data in $data, and make sure that
!       // $_xh[$parser]['ha'] is an array containing all the discarded
!       // headers.
!
!       // There is no sense in check $hdrfind, as it's defined as 0 above
!       // and nothing between there and here can modify it.
!
!       // First, I'm going to use preg_split to divide $data into an array
!       // of strings...
!       $headers = array ();
!       $data_array = preg_split("/\n/", $data);
!       foreach ($data_array as $line)
!       {
!               //echo "LINE: $line\n";
!               $line = trim ($line);
!               // if the line starts with '<', it's not a header...
!               if ( preg_match("/^</", $line) && ($line != "") )
!               {
!                       $new_data .= "$line";
!               }
!               elseif ( $line != "" )   // it is a header...
!               {
!                       $headers[] = "$line";
!               }
        }
-       $data = $new_data;
-       $_xh[$parser]['ha'] = $headers;
-
-       if ($this->debug)
-       {
-               foreach ($_xh[$parser]['ha'] as $header)
-               {
-                       echo "HEADER: $header\n";
-               }
-       }
-       //if ((!$hdrfnd) && ereg("^(.*)\r\n\r\n",$data,$_xh[$parser]['ha'])) {
-       //  $data=ereg_replace("^.*\r\n\r\n", "", $data);
-       //  $hdrfnd=1;
-       //}
 
        if (!xml_parse($parser, $data, sizeof($data))) {
                // thanks to Peter Kocks <[EMAIL PROTECTED]>
--- 556,565 ----
                return $r;
        }
        // gotta get rid of headers here
!       if ((!$hdrfnd) && ereg("^(.*)\r\n\r\n",$data,$_xh[$parser]['ha'])) {
!         $data=ereg_replace("^.*\r\n\r\n", "", $data);
!         $hdrfnd=1;
        }
 
        if (!xml_parse($parser, $data, sizeof($data))) {
                // thanks to Peter Kocks <[EMAIL PROTECTED]>

--
For information about how to subscribe and unsubscribe from this list
visit http://xmlrpc.usefulinc.com/list.html

Reply via email to