r5485: *** empty log message ***
[wol.git] / uri.lisp
index 7c38f304226c95c1c43d190cb8aadb25143fff39..4fe67dd1c0b696d9990283bbacf936d9a5bdf703 100644 (file)
--- a/uri.lisp
+++ b/uri.lisp
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  July 2003
 ;;;;
-;;;; $Id: uri.lisp,v 1.7 2003/08/09 21:42:24 kevin Exp $
+;;;; $Id: uri.lisp,v 1.9 2003/08/10 07:38:37 kevin Exp $
 ;;;;
 ;;;; This file and Wol are Copyright (c) 2003 by Kevin M. Rosenberg
 ;;;; *************************************************************************
@@ -15,7 +15,6 @@
 (in-package #:wol)
 
 (defun req-recode-uri-sans-session-id (req)
-  (setq cl-user::r req)
   (let ((ppath (puri:uri-parsed-path (request-uri req))))
     (when (is-raw-session-id (second ppath))
       (let ((new-path (list* (car ppath) (cddr ppath))))
           when (eq :cookie (car h))
           collect (cdr h))))
 
+(defun header-lines-matching (key headers)
+  (loop for hdr in headers
+      when (eq key (car hdr))
+      collect (cdr hdr)))
+
+(defun set-cookies-in-headers (headers)
+  (header-lines-matching :set-cookie headers))
+
+(defun cookies-in-headers (headers)
+  (header-lines-matching :cookie headers))
+
 (defun cookie-session-key (ent cookies)
+  "Return the session key from the alist of cookies"
   (let ((name (project-name (entity-project ent))))
     (cdr (assoc name cookies :test #'string-equal))))
 
          (prin1-to-string (nreverse output)))
       (push (compress-elem (car list)) output)
       (push (cadr list) output)))
+       
 
 (defun compress-elem (elem)
   "Encode a plist elem"
       (push (cadr elist) output))))
 
 (defun decompress-elem (elem)
-  (case elem
-    (:N :next-page)
-    (:T :posted)
-    (:O :object-id)
-    (:S :session-id)
-    (:L :lang)
-    (:G :logged)
-    (:C :caller)
-    (:D :db)
-    
-    ;; For posting to lookup-func1
-    (:F :func)
-    (:K :key)
-    (:B :subobjects)
-    (:A :labels)
-    (:E :english-only)
-    (:R :format)
-    
-    (:X :xml)
-    (:P :page)
+  (if (> (length (symbol-name elem)) 1)
+      elem
+    (case (char-upcase (schar (symbol-name elem ) 0))
+      (#\N :next-page)
+      (#\T :posted)
+      (#\O :object-id)
+      (#\S :session-id)
+      (#\L :lang)
+      (#\G :logged)
+      (#\C :caller)
+      (#\D :db)
+      
+      ;; For posting to lookup-func1
+      (#\F :func)
+      (#\K :key)
+      (#\B :subobjects)
+      (#\A :labels)
+      (#\E :english-only)
+      (#\R :format)
+      
+      (#\X :xml)
+      (#\P :page)
+      
+      (otherwise elem))))
+
+
+
+
 
-    (otherwise elem)))