From eac799afc38391234acfd0c09c71cbecd1746927 Mon Sep 17 00:00:00 2001 From: Andreas Rottmann Date: Thu, 2 Jul 2009 19:47:30 +0200 Subject: Convert the mod-lisp headers to lowercase HTTP headers are expected to be treated case-insensitively. --- tekuti/mod-lisp.scm | 3 ++- tekuti/page.scm | 2 +- tekuti/request.scm | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tekuti/mod-lisp.scm b/tekuti/mod-lisp.scm index 458f2bc..f209756 100644 --- a/tekuti/mod-lisp.scm +++ b/tekuti/mod-lisp.scm @@ -45,7 +45,8 @@ (let ((k (read-line*))) (if (string=? k "end") (reverse (map cons keys values)) - (lp (cons k keys) (cons (read-line*) values)))))) + (lp (cons (string-downcase k) keys) + (cons (read-line*) values)))))) (define (read-chars nchars port) (let ((buf (make-string nchars))) diff --git a/tekuti/page.scm b/tekuti/page.scm index 8330bf9..c9fcf7c 100644 --- a/tekuti/page.scm +++ b/tekuti/page.scm @@ -308,7 +308,7 @@ (server-name (request-server-name request))) (cond ((let ((since (assoc-ref (rref request 'headers '()) - "If-Modified-Since"))) + "if-modified-since"))) (and since (>= (rfc822-date->timestamp since) last-modified))) (rcons* request 'status 304 diff --git a/tekuti/request.scm b/tekuti/request.scm index 276691d..08b9adf 100644 --- a/tekuti/request.scm +++ b/tekuti/request.scm @@ -118,7 +118,7 @@ ;; danger here, regarding the optional alternate clauses... (define (request-authenticated? request) (let ((headers (rref request 'headers '()))) - (let ((auth (assoc-ref headers "Authorization"))) + (let ((auth (assoc-ref headers "authorization"))) (and auth (match-bind "^Basic ([A-Za-z0-9+/=]*)$" auth (_ b64) (match-bind "^([^:]*):(.*)$" @@ -193,7 +193,7 @@ (define (request-server-name request) (let ((headers (rref request 'headers))) - (or (assoc-ref headers "Host") + (or (assoc-ref headers "host") (assoc-ref headers "server-ip-addr")))) -- cgit v1.2.3-54-g00ecf