This commit is contained in:
Rudolph-Miller 2015-06-11 22:19:33 +09:00
parent 5f2ffe52fe
commit 626e527702
2 changed files with 5 additions and 2 deletions

View file

@ -7,4 +7,5 @@
:version "0.1"
:author "Eitaro Fukamachi"
:license "LLGPL"
:depends-on (:lack-component)
:components ((:file "src/middleware/mount")))

View file

@ -1,6 +1,8 @@
(in-package :cl-user)
(defpackage lack.middleware.mount
(:use :cl)
(:import-from :lack.component
:to-app)
(:export :*lack-middleware-mount*))
(in-package :lack.middleware.mount)
@ -12,13 +14,13 @@
(cond
((string= path-info path)
(setf (getf env :path-info) "/")
(funcall mount-app env))
(funcall (to-app mount-app) env))
((and (< len (length path-info))
(string= path-info path :end1 len)
(char= (aref path-info len) #\/))
(setf (getf env :path-info)
(subseq path-info (length path)))
(funcall mount-app env))
(funcall (to-app mount-app) env))
(t
(funcall app env)))))))
"Middleware for attaching another Lack application on a specific URL")