Re: PortableAserve (and WebActions, specifically)

Rudi Schlatte <[email protected]> Mon, 1 Mar 2004 21:37:59 +0100
Newsgroups gmane.lisp.open-source.franz
Message-ID <[email protected]>
--Apple-Mail-13--1065451823
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

[Cc'ing paserve-discuss; apologies for the full quote, but I think this=20=

is of general interest]

On 1. M=E4r 2004, at 18:25, Anthony W. Juckel wrote:

> I've been using the CVS version of PortableAserve for quite some time,=20=

> and was happy to see the inclusion of webactions after ILC2003.=20
> Unfortunately, I noticed a bug in webactions that would not allow you=20=

> to nest clp tags.

If you say that webactions more-or-less work in paserve, that's good to=20=

hear -- I haven't yet used them myself.

> For instance, the following would not work properly:
>
> <test_embedded>
>   <test_currval/>
>   <test_embedded>
>     <test_currval/>
>   </test_embedded>
> </test_embedded>
>
> And definitions:
>
> (defvar number-test 0)
> (def-clp-function test_embedded (req ent args body)
>   (let ((number-test (1+ number-test)))
>     (emit-clp-entity req ent body)))
> (def-clp-function test_currval (req ent args body)
>   (html ((:span :class "test_currval") (:princ number-test))))
>
> The problem was, net.aserve::scan-for-end-tag was not taking nested=20
> tags into account.  I updated it (probably naively, but it works for=20=

> me) to the version in the attached file.  Would you consider adding=20
> this (or a similar fix) to the portableaserve CVS repo?
>

Certainly.  But if it's a bug that only manifests itself on=20
_portable_allegroserve, I'd rather see it fixed it in the acl-compat=20
layer.  On the other hand, if it's a bug in WebActions itself, it=20
should perhaps be reported upstream.  I've Cc'ed the Franz opensource=20
list since they might be interested.

Thanks for the bug report, I'll keep you informed.

Rudi

[not snipping code for the benefit of portableaserve-discuss@sf and=20
opensource@franz ...]

> Anthony W. Juckel
> (in-package :net.aserve)
> (defun scan-for-end-tag (p module fcn)
>   "Scan for the end tag, taking nested tags into account."
>   (flet ((tag-name-matches-p (p tag-name)
> 		   (dotimes (i (length tag-name)
> 					 (let ((ch (peek-char nil p =
nil)))
> 					   (if (or (eq ch #\ )
> 							   (eq ch #\>))
> 						   (progn
> 							 (peek-char #\> =
p nil)
> 							 (read-char p =
nil nil)
> 							 (return-from =
tag-name-matches-p t))
> 						   (return-from =
tag-name-matches-p nil))))
> 			 (let ((ch (read-char p nil nil)))
> 			   (when (or (null ch)
> 						 (not (eq ch (aref =
tag-name i))))
> 				 (return-from tag-name-matches-p =
nil))))))
>     (let ((tag-name (format nil "~a_~a" module fcn))
> 		  (nest-level 1)
> 	      (start-pos (file-position p)))
>       (loop
>        (if (peek-char #\< p nil); Take the #\< off the stream
> 		   (read-char p nil nil)
> 		   (return-from scan-for-end-tag nil))
>        (let ((char (peek-char t p nil)))
> 		 (cond
> 		   ((eq char #\/)
> 			(read-char p nil nil)
> 		    (when (and (tag-name-matches-p p tag-name)
> 					   (zerop (decf nest-level)))
> 			  (return-from scan-for-end-tag (- =
(file-position p)
> 										=
	   start-pos
> 										=
	   (length (format nil "</~a>" tag-name))))))
> 	       (t
> 			(when (tag-name-matches-p p tag-name)
> 			  (incf nest-level))))))))clx-user)=

--Apple-Mail-13--1065451823
content-type: application/pgp-signature; x-mac-type=70674453;
	name=PGP.sig
content-description: This is a digitally signed message part
content-disposition: inline; filename=PGP.sig
content-transfer-encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)

iD8DBQFAQ58u765FppppCGcRAtCSAJ9V9EB7GhJpzxY+iVw/FuEgo1LUcQCg2yVr
JNrdvjmCP5GLbEe7fMd1MhE=
=8Njk
-----END PGP SIGNATURE-----

--Apple-Mail-13--1065451823--