--- web.lsp.orig 2009-08-14 21:23:09.000000000 +0200 +++ web.lsp 2011-01-13 10:22:47.000000000 +0100 @@ -196,7 +196,7 @@ ;; @link http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references Wikipedia. (define (encode-entities str , ent (buf "")) (dostring (c str) - (write-buffer buf + (write buf (if (setf ent (lookup c ENTITIES)) ent (char c)))) buf) @@ -616,11 +616,11 @@ (when (and start (not end)) (throw-error "Unbalanced tags."))) (while (and start end) - (write-buffer buf (string "(print [text]" (slice str 0 start) "[/text])")) + (write buf (string "(print [text]" (slice str 0 start) "[/text])")) (setf block (slice str (+ start 2) (- end start 2))) (if (starts-with block "=") - (write-buffer buf (string "(print " (rest block) ")")) - (write-buffer buf (trim block))) + (write buf (string "(print " (rest block) ")")) + (write buf (trim block))) (setf str (slice str (+ end 2))) (setf start (find OPEN_TAG str)) (setf end (find CLOSE_TAG str)) @@ -633,7 +633,7 @@ (inc end (+ next-end 2))) (when (and start (not end)) (throw-error "Unbalanced tags.")))) - (write-buffer buf (string "(print [text]" str "[/text])")) + (write buf (string "(print [text]" str "[/text])")) (eval-string buf ctx)) ;=============================================================================== @@ -672,10 +672,9 @@ ; Read POST data (if-not (context? CGI) ;; CGI module not present; read and parse the POST data ourselves - (let ((post "") (buffer "")) + (let ((post "")) (unless (zero? (peek (device))) - (while (read-buffer (device) buffer POST_LIMIT) - (write-buffer post buffer))) + (read (device) post (integer (env "CONTENT_LENGTH")))) (setf POST (when post (parse-query post))))