Changeset 13054 in project


Ignore:
Timestamp:
01/21/09 23:54:48 (11 years ago)
Author:
sjamaan
Message:

Switch to uri-common

Location:
release/4/spiffy/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • release/4/spiffy/trunk/spiffy.scm

    r12705 r13054  
    5151(import chicken scheme extras ports files data-structures)
    5252(require-extension srfi-1 srfi-18 tcp regex posix
    53                    intarweb uri-generic sendfile matchable)
     53                   intarweb uri-common sendfile matchable)
    5454
    5555(define version 4)
     
    291291         (match remaining-path
    292292                (()    (redirect-directory-root (make-pathname "/" current-path)))
    293                 (("/") (process-directory current-path))
     293                (("") (process-directory current-path))
    294294                (else  (process-entry (make-pathname current-path (car remaining-path))
    295295                                      (cdr remaining-path)))))))
     
    353353                 (with-output-to-string print-call-chain))
    354354            (let ((path (uri-path (request-uri (current-request)))))
    355               (if (and (uri-host (request-uri (current-request))) (pair? path))
     355              (if (and (uri-host (request-uri (current-request))) (pair? path)
     356                       (eq? (car path) '/))
    356357                  (let* ((host (uri-host (request-uri (current-request))))
    357358                         (handler (alist-ref host (vhost-map)
     
    361362                                                   (string-match h host))))))
    362363                    (if handler
    363                         (handler (lambda () (process-entry "" path)))
     364                        (handler (lambda () (process-entry "" (cdr path))))
    364365                        ;; Is this ok?
    365366                        ((handle-not-found) path)))
  • release/4/spiffy/trunk/tests/run.scm

    r12655 r13054  
    6262
    6363(test-begin "path normalization")
    64 (test "index page redir" '("/subdir" "/") (uri-path (header-value 'location (get-headers "/subdir" "testhost"))))
     64(test "index page redir" '(/ "subdir" "") (uri-path (header-value 'location (get-headers "/subdir" "testhost"))))
    6565(test "index page redir preserves GET args" '((foo . "bar")) (uri-query (header-value 'location (get-headers "/subdir?foo=bar" "testhost"))))
    6666(test "index page redir status" 301 (car (fetch-file "/subdir" "testhost")))
     
    6868(test "break out of webroot fails" `(200 ,index-subdir) (fetch-file "/subdir/../../subdir/" "testhost"))
    6969(test "index page in subdir vhost" `(200 ,index-subdir) (fetch-file "/" "subdir-host"))
    70 (test "index page redir for subdir vhost" '("/subsubdir" "/") (uri-path (header-value 'location (get-headers "/subsubdir" "subdir-host"))))
     70(test "index page redir for subdir vhost" '(/ "subsubdir" "") (uri-path (header-value 'location (get-headers "/subsubdir" "subdir-host"))))
    7171(test "index page redir status for subdir vhost" `301 (car (fetch-file "/subsubdir" "subdir-host")))
    7272(test "index page in subdir for subdir vhost" `(200 ,index-subsubdir) (fetch-file "/subsubdir/" "subdir-host"))
  • release/4/spiffy/trunk/tests/testlib.scm

    r12655 r13054  
    1 (require-extension spiffy uri-generic intarweb)
     1(require-extension spiffy uri-common intarweb)
    22
    33(server-port (string->number (or (getenv "SPIFFY_TEST_PORT") "8080")))
Note: See TracChangeset for help on using the changeset viewer.