Blob Blame History Raw
diff -ur xmlrpc-light-0.6.1.old/XmlRpc.ml xmlrpc-light-0.6.1.new/XmlRpc.ml
--- xmlrpc-light-0.6.1.old/XmlRpc.ml	2017-11-22 15:13:02.619638079 +0000
+++ xmlrpc-light-0.6.1.new/XmlRpc.ml	2017-11-22 15:12:44.777639983 +0000
@@ -253,13 +253,13 @@
 
 (* Workaround for Xml-Light, which doesn't like dots in tag names. *)
 let fix_dotted_tags s =
-  let len = String.length s in
+  let len = Bytes.length s in
   let in_tag = ref false in
   for i = 0 to len - 1 do
-    match s.[i] with
+    match Bytes.get s i with
       | '<' -> in_tag := true
       | '>' -> in_tag := false
-      | '.' when !in_tag -> s.[i] <- ':'
+      | '.' when !in_tag -> Bytes.set s i ':'
       | _ -> ()
   done
 
@@ -270,11 +270,11 @@
     close_out out_channel;
     let buffer_size = 2048 in
     let buffer = Buffer.create buffer_size in
-    let string = String.create buffer_size in
+    let string = Bytes.create buffer_size in
     let chars_read = ref 1 in
     while !chars_read <> 0 do
       chars_read := input in_channel string 0 buffer_size;
-      Buffer.add_substring buffer string 0 !chars_read
+      Buffer.add_subbytes buffer string 0 !chars_read
     done;
     let status = Unix.close_process (in_channel, out_channel) in
     (status, Buffer.contents buffer)
@@ -383,7 +383,9 @@
         match status with
           | Unix.WEXITED 0 ->
               if debug then prerr_endline contents;
+              let contents = Bytes.of_string contents in
               fix_dotted_tags contents;
+              let contents = Bytes.to_string contents in
               (match (message_of_xml_element
                         ~base64_decoder
                         ~datetime_decoder
@@ -457,7 +459,9 @@
         match call#status with
           | `Successful ->
               let contents = call#get_resp_body () in
+              let contents = Bytes.of_string contents in
               fix_dotted_tags contents;
+              let contents = Bytes.to_string contents in
               (match (message_of_xml_element
                         ~base64_decoder
                         ~datetime_decoder
@@ -553,7 +557,9 @@
     ?(datetime_decoder=XmlRpcDateTime.of_string)
     ?(error_handler=default_error_handler)
     f s =
+  let s = Bytes.of_string s in
   fix_dotted_tags s;
+  let s = Bytes.to_string s in
   try
     begin
       try