On 10/15/06, Kon Lovett <[EMAIL PROTECTED]> wrote:

This might help:

http://lists.gnu.org/archive/html/chicken-hackers/2006-10/msg00007.html

In fact, adding this is simple enough like this (mind-bogglingly naive
example follows):

(http:fallback-handler
(let ((old (http:fallback-handler)))
  (lambda (req)
    (let ((url (http:request-url req)))
      (match (string-match "/add/(.*)" url)
         ((_ text)
          (let ((result (->string (apply + (map string->number (string-split
text "/"))))))
            (write-response-header req)
            (printf "Content-Length: ~A\r\n\r\n~a" (string-length result) 
result)))
         (_ (old req)))))))

This of course screams out for a better interface, but the implementation
is relatively straightforward (for example keeping "dynamic" urls/handlers in
a separate hash-table).


cheers,
felix


--
http://galinha.ucpel.tche.br:8081/blog/blog.ssp


_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to