Welcome to the CHICKEN Scheme pasting service

Rewrite requested path pasted by mario-goulart on Mon Jun 11 14:44:33 2012

(use spiffy intarweb uri-common)

(vhost-map
 `((".*" .
    ,(lambda (continue)
       (request-uri-set! (current-request)
			 (update-uri (request-uri (current-request))
				     path: '(/)))
       (continue)))))

(start-server)

With update-request (doesn't work either) pasted by mario-goulart on Mon Jun 11 15:11:57 2012

(use spiffy intarweb uri-common)

(vhost-map
 `((".*" .
    ,(lambda (continue)
       (let ((req (current-request)))
	 (parameterize ((current-request
			 (update-request req
					 uri: (update-uri (request-uri req)
							  path: '(/)))))
	   (continue)))))))

(start-server)

bugfix for Spiffy added by sjamaan on Mon Jun 11 15:29:31 2012

Index: spiffy.scm
===================================================================
--- spiffy.scm  (revision 26763)
+++ spiffy.scm  (working copy)
@@ -475,8 +475,7 @@
             ((handle-exception) exn
              (with-output-to-string print-call-chain))
             #f)                         ; Do not keep going
-          (let* ((req-uri (request-uri (current-request)))
-                 (host (uri-host req-uri)))
+          (let ((host (uri-host (request-uri (current-request)))))
             (if (and host (uri-path-absolute? (request-uri (current-request))))
                 (let ((handler
                        (alist-ref host (vhost-map)
@@ -486,7 +485,8 @@
                                         (string-match h host))))))
                   (if handler
                       (handler (lambda ()
-                                (process-entry "" "" (cdr (uri-path req-uri)))))
+                                (let ((req-uri (request-uri (current-request))))
+                                   (process-entry "" "" (cdr (uri-path req-uri))))))
                       ;; Is this ok?
                       ((handle-not-found) (uri-path req-uri))))
                 ;; No host or non-absolute URI in the request is an error.

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which R5RS procedure returns `'(2 3)' when given `'(1 2 3)' as input?
Visually impaired? Let me spell it for you (wav file) download WAV