From sven at beta9.be Fri Apr 14 10:15:48 2006 From: sven at beta9.be (Sven Van Caekenberghe) Date: Fri, 14 Apr 2006 12:15:48 +0200 Subject: [s-xml-rpc-devel] Re: [(nowhere)] Incorrect decoding of XML RPC messages In-Reply-To: <87bqv4zpqh.fsf@memetrics.com> References: <87bqv4zpqh.fsf@memetrics.com> Message-ID: <22504364-959B-4FD4-81C3-247DB986BFB0@beta9.be> Alain, On 14 Apr 2006, at 07:32, Alain Picard wrote: > Once upon a time (release 6, Januari 21, 2004) xml-rpc used to decode > messages thusly: > > XML-RPC> (decode-xml-rpc (make-string-input-stream > " > > > > > ")) > NIL > XML-RPC> > > But now (2004-06-17 Rudi Schlatte ), > it does it this way: > S-XML-RPC> (decode-xml-rpc (make-string-input-stream > " > > > > > ")) > " > " > > Which I think is COMPLETELY wrong. > > Whereas > S-XML-RPC> (decode-xml-rpc (make-string-input-stream > "")) > NIL > > Is still OK. > > So I think something is wrong with the parser. The handling of whitespace (or the significance of whitespace) in XML and especially in between elements is tricky. I know that it is allowed and sometimes significant. So I would say that it depends upon the XML application, in this case XML-RPC. The XML-RPC spec is not superclear about all this. But what is clear is that a element can only contain elements and nothing else. So the simplest change that I could make to fix your testcase would be: [sven at voyager:~/apps/clnet/s-xml-rpc/s-xml-rpc]$ cvs diff src/xml- rpc.lisp Index: src/xml-rpc.lisp =================================================================== RCS file: /project/s-xml-rpc/cvsroot/s-xml-rpc/src/xml-rpc.lisp,v retrieving revision 1.8 diff -r1.8 xml-rpc.lisp 281c281 < (:|data| (nreverse seed)) --- > (:|data| (unless (stringp seed) (nreverse seed))) (I did not yet check this in). This change comes down to the following: before, any subelements (including text and/or whitespace) of were accepted as is; now, all text (whitespace or not) as subelement of are ignored. Does this work for you ? Does anybody else have any opinion about this ? Sven -- Sven Van Caekenberghe - mailto:sven at beta9.be Beta Nine - software engineering - http://www.beta9.be .Mac - svc at mac.com - http://homepage.mac.com/svc "Lisp isn't a language, it's a building material." - Alan Kay From sven at beta9.be Wed Apr 19 10:51:47 2006 From: sven at beta9.be (Sven Van Caekenberghe) Date: Wed, 19 Apr 2006 12:51:47 +0200 Subject: [s-xml-rpc-devel] Re: Incorrect decoding of XML RPC messages In-Reply-To: <87r73vcwhi.fsf@memetrics.com> References: <87bqv4zpqh.fsf@memetrics.com> <22504364-959B-4FD4-81C3-247DB986BFB0@beta9.be> <87fykd99xw.fsf@memetrics.com> <87r73vcwhi.fsf@memetrics.com> Message-ID: On 18 Apr 2006, at 06:56, Alain Picard wrote: > Okay -- I've got a fix which ensures that things > like " " decode as NIL, instead of " ". > > Here are the diffs, in case you want to have a look > and/or fold them in. > > > The gist of it now is that if you're inside a , > you always get a string if the inner type is not specified, > since the spec says: > "If no type is indicated, the type is string." > > Thus "" now decodes as "". > > I also fixed what I think is a bug in that > (encode-xml-rpc-value T) ==> "T" instead of 1. > (same for NIL). > > Alain, I tried to integrate your changes; I didn't take over the special variable: it felt less elegant and I think I managed to solve all your problems without it. I took over most of your code though: thanks! I added a number of extra test cases to test-xml-rpc.lisp to cover all the problems that you reported. Have a look at it and tell me if this works for you. This is the official change log entry (all changes were commit but not yet released as tarball): * changes due to reporting and initial fixes by Alain Picard * added support for whitespace handling * iso8601->universal-time now accepts leading & trailing whitespace * encode-xml-rpc-value now encodes t and nil correctly as boolean 1 and 0 * parsing doubles (using read-from-string) with reader macros disabled for security * decode-xml-rpc now handles whitespace more correctly in and tags * added several test cases and fixed older stop-server problem I enclosed a context diff here for your convenience. Sven -------------- next part -------------- A non-text attachment was scrubbed... Name: ap-changes.diff Type: application/octet-stream Size: 4291 bytes Desc: not available URL: -------------- next part --------------