[plt-scheme] http basic auth

From: maxigas (maxigas at anargeek.net)
Date: Sat Sep 5 15:17:08 EDT 2009

hi!

i have trouble using basic authentication with plt-web-server as described here:

http://docs.plt-scheme.org/web-server/http.html#(def._((lib._web-server/http/basic-auth..ss)._make-basic-auth-header))

as far as i understand (require web-server/http/basic-auth) should contain the function request->basic-credentials but it doesn't seem to work:

Welcome to MzScheme v4.1.4 [3m], Copyright (c) 2004-2009 PLT Scheme Inc.
 > (require web-server/http/basic-auth)
 > (request->basic-credentials (make-request))
 reference to undefined identifier: request->basic-credentials
 
i tried to run the example script in the docs but go the same error:

----

#lang scheme
(require web-server/servlet)
(require web-server)

(require web-server/http/basic-auth)
(define (start req)
  (match (request->basic-credentials req)
         [(cons user pass)
          `(html (head (title "Basic Auth Test"))
                 (body (h1 "User: " ,(bytes->string/utf-8 user))
                       (h1 "Pass: " ,(bytes->string/utf-8 pass))))]
         [else
          (make-response/basic
           401 #"Unauthorized" (current-seconds) TEXT/HTML-MIME-TYPE
           (list
            (make-basic-auth-header
             (format "Basic Auth Test: ~a" (gensym)))))]))


----

mxs at char: mzscheme atest.ss 
atest.ss:5:10: compile: unbound identifier in module in: request->basic-credentials


Posted on the users mailing list.