strange authorizer behavior

Wojciech Sobczuk <[email protected]> Fri, 19 Jul 2002 18:17:37 +0200
Newsgroups gmane.lisp.open-source.franz
Organization NEMO
Message-ID <[email protected]>
Hello,

I have done the following:

(defparameter krl-authorizer
  (make-instance
    'function-authorizer
    :function #'(lambda (req ent auth)
                  (let ((sess (web:session-from-req req)))
                    (if (and sess (web:session-val :krl-user sess))
                      t
                      (with-http-response (req ent)
                          (lweb:redirect *addr-logform* req)
                          (with-http-body (req ent)
                                          :done)))))))

(defun publish-lsp (&key path file (server net.aserve:*wserver*) authorizer)
  "Publishes an LSP file.  PATH is a string containing the name part
   of the URL at which to publish the file, e.g. \"/math/sum.lsp\";
   FILE is a pathname that specifies the file containing the page
   to publish."
  (net.aserve:publish :path path
                      :server server
                      :authorizer authorizer
                      :function #'(lambda (request entity)
                                    (do-lsp-request request entity file))))


  (publish-directory
    :prefix "/home/"
    :destination "/home/krl/webroot/home/"
    :authorizer krl-authorizer)

  (lsp:publish-lsp
    :path "/home/friends.htm"
    :authorizer krl-authorizer
    :file (krl-home-dir "friends.htm"))

Then when I do a request, here's what happens:

 > telnet localhost 8080
Trying 127.0.0.1...
Connected to localhost.puff.pl.
Escape character is '^]'.
GET /home/friends.htm HTTP/1.1

HTTP/1.1 302  Found
Date: Fri, 19 Jul 2002 15:23:01 GMT
Connection: Close
Server: AllegroServe/1.2.23
LOCATION: /register.htm

HTTP/1.1 302  Found
Date: Fri, 19 Jul 2002 15:23:01 GMT
Connection: Close
Server: AllegroServe/1.2.23
LOCATION: /register.htm

HTTP/1.1 404  Not Found
Date: Fri, 19 Jul 2002 15:23:01 GMT
Connection: Close
Server: AllegroServe/1.2.23
Content-Type: text/html
LOCATION: /register.htm

<head><title>404 - NotFound</title><body><h1>Not Found</h1>The request 
for <b>/home/friends.htm</b> was not found on this 
server.<br><br><hr><i>AllegroServe 1.2.23</i></body></head>Connection 
closed by foreign host.


If I remove the authorizer from publish-lsp for /home/friends.htm I get 
the contents of friends.htm (the directory authorizer for /home isn't 
invoked, which is probably the correct behavior).  What I don't 
understand is the 3 responses above..

Thanks,
Wojciech Sobczuk

-- 
Wojciech Sobczuk
NEMO Labs
http://www.nemo.pl/