关于“合并路径名”的奇怪行为:
* (merge-pathnames "nav.py" "/media/E/myapp/cgi-bin/")
#P"/media/E/myapp/cgi-bin/nav.py"
它在 SBCL REPL 中正常工作。但是,当破解“create-cgi-dispatcher-and-handler”时,我添加了以下几行:
(defun create-cgi-dispatcher-and-handler (uri-prefix base-path &optional content-type)
;...
(format t "SName=~A SPath=~A BPath=~A~% the path is ~A~%" script-name script-path base-path (merge-pathnames script-path base-path))
;...
如下调用它:
(pushnew (hunchentoot-cgi::create-cgi-dispatcher-and-handler
"/cgi-bin/"
(make-pathname :name "cgi-bin/" :type nil :version nil :defaults *this-file*)
) *dispatch-table* :test #'equal)
然后访问http://127.0.0.1:8000/cgi-bin/nav.py,它报告:
SName=/cgi-bin/nav.py SPath=nav.py BPath=/media/E/myapp/cgi-bin/
the path is /media/E/myapp/nav.py
简而言之:
(merge-pathnames "nav.py" "/media/E/myapp/cgi-bin/") 在 REPL 中返回 #P"/media/E/myapp/cgi-bin/nav.py"。但它在 hunchentoot-cgi.lisp 中返回“/media/E/myapp/nav.py”。
真挚地!