[claw-cvs] r176 - trunk/main/claw-as/src

Andrea Chiumenti achiumenti at common-lisp.net
Tue Dec 30 17:36:00 UTC 2008


Author: achiumenti
Date: Tue Dec 30 17:36:00 2008
New Revision: 176

Log:
base path bugfix (when path are empty string for sesisons and lisplets)

Modified:
   trunk/main/claw-as/src/lisplet.lisp
   trunk/main/claw-as/src/server.lisp

Modified: trunk/main/claw-as/src/lisplet.lisp
==============================================================================
--- trunk/main/claw-as/src/lisplet.lisp	(original)
+++ trunk/main/claw-as/src/lisplet.lisp	Tue Dec 30 17:36:00 2008
@@ -125,7 +125,7 @@
 (defmethod claw-server-register-lisplet ((claw-server claw-server) (lisplet lisplet))
   (let ((lisplets (claw-server-lisplets claw-server))
         (location (lisplet-base-path lisplet)))
-    (unless (string= "/" (subseq location 0 1))
+    (when (or (string= "" location) (not (starts-with-subseq "/" location)))
       (setf location (concatenate 'string "/" location)))
     (setf (lisplet-server-address lisplet) (claw-server-address claw-server)
           (claw-server-lisplets claw-server) (sort-by-location (pushnew-location

Modified: trunk/main/claw-as/src/server.lisp
==============================================================================
--- trunk/main/claw-as/src/server.lisp	(original)
+++ trunk/main/claw-as/src/server.lisp	Tue Dec 30 17:36:00 2008
@@ -308,8 +308,6 @@
          (*server-path* (or (when (claw-proxified-p) 
                               (claw-server-reverse-proxy-path claw-server))
                             (claw-server-base-path claw-server)))
-         (rel-script-name)
-         (rel-script-name-libs)
          (http-result nil))
     (handler-case 
         (progn
@@ -317,23 +315,21 @@
                (catch 'handler-done
                  (progn 
                    (setf (claw-return-code) +http-not-found+)
-                   (if (starts-with-subseq base-path script-name)
-                       (progn
-                         (setf rel-script-name (subseq script-name (length base-path))
-                               rel-script-name-libs (subseq script-name (length base-path)))
-                         (setf http-result (or
-                                            (loop for dispatcher in *claw-libraries-resources*
-                                               for url = (car dispatcher)
-                                               for action = (cdr dispatcher)
-                                               do (when (starts-with-subseq url rel-script-name-libs)
-                                                    (setf (claw-return-code) +http-ok+)
-                                                    (funcall action)))
-                                            (loop for lisplet-cons in lisplets
-                                               for url = (car lisplet-cons)
-                                               for lisplet = (cdr lisplet-cons)
-                                               do (when (starts-with-subseq url rel-script-name)
-                                                    (setf (claw-return-code) +http-ok+)
-                                                    (return (funcall #'lisplet-dispatch-method lisplet)))))))))))
+                   (when (or (string= "" script-name) (starts-with-subseq base-path script-name))
+                     (let ((rel-script-name (subseq script-name (length base-path))))
+                       (setf http-result (or
+                                          (loop for dispatcher in *claw-libraries-resources*
+                                             for url = (car dispatcher)
+                                             for action = (cdr dispatcher)
+                                             do (when (starts-with-subseq url rel-script-name)
+                                                  (setf (claw-return-code) +http-ok+)
+                                                  (funcall action)))
+                                          (loop for lisplet-cons in lisplets
+                                             for url = (car lisplet-cons)
+                                             for lisplet = (cdr lisplet-cons)
+                                             do (when (starts-with-subseq url rel-script-name)
+                                                  (setf (claw-return-code) +http-ok+)
+                                                  (return (funcall #'lisplet-dispatch-method lisplet)))))))))))
           (or http-result
               (and (>= (claw-return-code) 400)
                    (or
@@ -353,8 +349,7 @@
                                                                 (if (= return-code +http-ok+)
                                                                     nil
                                                                     return-code))
-                                                              +http-not-found+)))))
-                ))
+                                                              +http-not-found+)))))))
       (error (cond)
         (logger-log (claw-server-log-manager claw-server) :error "~a" cond)
         (with-output-to-string (*standard-output*) (error-renderer claw-server :error-code +http-internal-server-error+))))))




More information about the Claw-cvs mailing list