Hello,
I have a patch for Pike 7.2 XMLRPC. The spec at http://www.xml-rpc.org/ says the <value> element can contain <string>, <array> and so on but can also contain a PCDATA by itself ("If no type is indicated, the type is string."). This wasn't set in XMLRPC.pmod and this is used by some client like XML-RPC Apache project one.
Here is the patch:
on Feb 23 16:38:40 2004 @@ -137,7 +137,7 @@ <!ELEMENT params (param*)> <!ELEMENT param (value)>
- <!ELEMENT value (boolean|i4|int|double|string|base64| + <!ELEMENT value (#PCDATA|boolean|i4|int|double|string|base64| array|struct|dateTime.iso8601)>
<!ELEMENT boolean (#PCDATA)> @@ -231,6 +231,8 @@ // seems to assume localtime). return Calendar.parse("%dT%h:%m:%s", data*"") || magic_zero; + // the spec says that the default is string inside value + default: return data*""; } error("Unknown element %O.\n", name); case "error":
/ David
Here is the patch:
on Feb 23 16:38:40 2004 @@ -137,7 +137,7 @@ <!ELEMENT params (param*)> <!ELEMENT param (value)>
- <!ELEMENT value (boolean|i4|int|double|string|base64|
<!ELEMENT value (#PCDATA|boolean|i4|int|double|string|base64| array|struct|dateTime.iso8601)>
<!ELEMENT boolean (#PCDATA)>
Actually this is enough, no need to apply the lines after.
/ David
Are the testsuite tests that started to fail after that change broken?
/ Johan Sundström (Achtung Liebe!)
Previous text:
2004-02-23 17:01: Subject: Re: XMLRPC patch for 7.2
Here is the patch:
on Feb 23 16:38:40 2004 @@ -137,7 +137,7 @@ <!ELEMENT params (param*)> <!ELEMENT param (value)>
- <!ELEMENT value (boolean|i4|int|double|string|base64|
<!ELEMENT value (#PCDATA|boolean|i4|int|double|string|base64| array|struct|dateTime.iso8601)>
<!ELEMENT boolean (#PCDATA)>
Actually this is enough, no need to apply the lines after.
/ David
/ Brevbäraren
No, my fix wasn't enough, the decoding was failing as soon as you had some data between <value> and the inner container (the testsuite contains \n). The testsuite for xmlrpc is working again on 7.4 and 7.5 on my machine.
Are the testsuite tests that started to fail after that change broken?
/ Johan Sundström (Achtung Liebe!)
Previous text:
2004-02-23 17:01: Subject: Re: XMLRPC patch for 7.2
Here is the patch:
on Feb 23 16:38:40 2004 @@ -137,7 +137,7 @@
<!ELEMENT params (param*)>
<!ELEMENT param (value)>
- <!ELEMENT value (boolean|i4|int|double|string|base64|
<!ELEMENT value (#PCDATA|boolean|i4|int|double|string|base64| array|struct|dateTime.iso8601)>
<!ELEMENT boolean (#PCDATA)>
Actually this is enough, no need to apply the lines after.
/ David
/ Brevbäraren
The new patch for 7.2 is attached.
Johan Sundström (Achtung Liebe!) @ Pike (-) developers forum wrote:
Are the testsuite tests that started to fail after that change broken?
/ Johan Sundström (Achtung Liebe!)
Previous text:
2004-02-23 17:01: Subject: Re: XMLRPC patch for 7.2
Here is the patch:
on Feb 23 16:38:40 2004 @@ -137,7 +137,7 @@
<!ELEMENT params (param*)>
<!ELEMENT param (value)>
- <!ELEMENT value (boolean|i4|int|double|string|base64|
<!ELEMENT value (#PCDATA|boolean|i4|int|double|string|base64| array|struct|dateTime.iso8601)>
<!ELEMENT boolean (#PCDATA)>
Actually this is enough, no need to apply the lines after.
/ David
/ Brevbäraren
--- module.pmod Tue Jul 17 13:10:27 2001 +++ module.pmod.new Wed Feb 25 11:26:02 2004 @@ -137,7 +137,7 @@ <!ELEMENT params (param*)> <!ELEMENT param (value)>
- <!ELEMENT value (boolean|i4|int|double|string|base64| + <!ELEMENT value (#PCDATA|boolean|i4|int|double|string|base64| array|struct|dateTime.iso8601)>
<!ELEMENT boolean (#PCDATA)> @@ -175,6 +175,10 @@ // We cannot insert 0 integers directly into the parse tree, so // we'll use magic_zero as a placeholder and destruct it afterwards. object magic_zero = class {}(); + // one more fix because some people found the specs too easy and + // decided you can have <value>test</value> (that is omitting string inside a value) + object mystring = class { string s; }(); + Parser.XML.Validating xml = Parser.XML.Validating(); array tree = xml-> parse(xml_input, @@ -202,10 +206,18 @@ { case "methodResponse": case "param": - case "value": case "array": case "fault": return data[0]; + case "value": + foreach(data, mixed value) + if(!stringp(value)) + { + if(objectp(value) && value->s) + return value->s; + return value; + } + return data[0]; case "i4": case "int": case "boolean": @@ -213,11 +225,14 @@ case "double": return (float)(data*""); case "string": + mystring->s = data*""; + return mystring; case "name": case "methodName": return data*""; case "base64": - return MIME.decode_base64(data*""); + mystring->s = MIME.decode_base64(data*""); + return mystring; case "methodCall": case "params": case "member":
Thanks, applied.
/ Henrik Grubbström (Lysator)
Previous text:
2004-02-25 11:29: Subject: Bilaga (XMLRPC.pmod.diff) till: Re: XMLRPC patch for 7.2
--- module.pmod Tue Jul 17 13:10:27 2001 +++ module.pmod.new Wed Feb 25 11:26:02 2004 @@ -137,7 +137,7 @@
<!ELEMENT params (param*)>
<!ELEMENT param (value)>
- <!ELEMENT value (boolean|i4|int|double|string|base64|
<!ELEMENT value (#PCDATA|boolean|i4|int|double|string|base64| array|struct|dateTime.iso8601)>
<!ELEMENT boolean (#PCDATA)>
@@ -175,6 +175,10 @@ // We cannot insert 0 integers directly into the parse tree, so // we'll use magic_zero as a placeholder and destruct it afterwards. object magic_zero = class {}();
- // one more fix because some people found the specs too easy and
- // decided you can have <value>test</value> (that is omitting string inside a value)
- object mystring = class { string s; }();
- Parser.XML.Validating xml = Parser.XML.Validating(); array tree = xml-> parse(xml_input,
@@ -202,10 +206,18 @@ { case "methodResponse": case "param":
case "value": case "array": case "fault": return data[0];
case "value":
foreach(data, mixed value)
if(!stringp(value))
{
if(objectp(value) && value->s)
return value->s;
return value;
}
return data[0]; case "i4": case "int": case "boolean":
@@ -213,11 +225,14 @@ case "double": return (float)(data*""); case "string":
mystring->s = data*"";
return mystring; case "name": case "methodName": return data*""; case "base64":
return MIME.decode_base64(data*"");
mystring->s = MIME.decode_base64(data*"");
return mystring; case "methodCall": case "params": case "member":
/ Brevbäraren
pike-devel@lists.lysator.liu.se