Page 1 of 1

Patch for xmlrpc module

Posted: Mon Mar 26, 2012 6:05 pm
by kosh
Hello Lutz.
This patch is for correcting XML-RPC module (xmlrpc.cgi and xmlrpc-client.lsp).

example/xmlrpc.cgi:

Code: Select all

--- newlisp-10.4.0/examples/xmlrpc.cgi.orig	2012-03-07 02:42:20.000000000 +0900
+++ newlisp-10.4.0/examples/xmlrpc.cgi	2012-03-26 14:40:35.000000000 +0900
@@ -128,7 +128,7 @@
     
 
 (define (system.methodHelp params, methodName)
-    (set 'methodName (nth (params 0 1 1 1 1)))
+    (set 'methodName (params 0 1 1 1 1))
     (case methodName
         ("system.listMethods" (format normal-response "Lists all methods implemented."))
         ("system.methodHelp" (format normal-response "Documents a method."))
@@ -138,7 +138,7 @@
 )
 
 (define (system.methodSignature params)
-    (set 'methodName (nth (params 0 1 1 1 1)))
+    (set 'methodName (params 0 1 1 1 1))
     (case methodName
         ("system.listMethods" (format normal-response 
 "<array>
module/xmlrpc-client.lsp:

Code: Select all

--- newlisp-10.4.0/modules/xmlrpc-client.lsp.orig	2012-02-14 23:51:11.000000000 +0900
+++ newlisp-10.4.0/modules/xmlrpc-client.lsp	2012-03-26 14:09:38.466104400 +0900
@@ -114,6 +114,8 @@
 ;
 (define (get-value expr)
     (if (empty? expr) nil
+
+        (list? (expr 1))
         (case (expr 1 0)
             ("i4" (int (expr 1 1)))
             ("int" (int (expr 1 1)))
@@ -126,7 +128,10 @@
                          (get-array (rest (expr 1 1)))) )
             ("struct" (get-struct (rest (expr 1))))
             ("string" (expr 1 1))
-            (true (expr 1)))) )
+            (true (expr 1)))
+
+        true (string (expr 1))       ; If no type is indicated, the type is string.
+      ))
 
 ; get contents from expr = ((value ...) (value ...) ...)
 ;
Now, XML-RPC sample will works well.

Code: Select all

> (module "xmlrpc-client.lsp")
MAIN
> (XMLRPC:system.methodSignature "http://example.com/xmlrpc.cgi" "newLISP.evalString")
(("base64" "base64"))
; A past return value is (("m\030" "m\030"))

Re: Patch for xmlrpc module

Posted: Mon Mar 26, 2012 8:49 pm
by Lutz