From ef48e4e5aed97a145a8caa2706d0ec085ef697a3 Mon Sep 17 00:00:00 2001 From: vibr Date: Sat, 14 Aug 2004 22:03:19 +0000 Subject: [PATCH] make-host-name-handler now uses get-header from sunet-utilities.scm --- scheme/httpd/handlers.scm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scheme/httpd/handlers.scm b/scheme/httpd/handlers.scm index a258693..88fd8a3 100644 --- a/scheme/httpd/handlers.scm +++ b/scheme/httpd/handlers.scm @@ -48,9 +48,12 @@ (make-predicate-handler (lambda (path req) ;; we expect only one host-header-field - (let ((body (string-trim (get-header (request-headers req) 'host)))) - (or (string-ci=? hostname body) - (string-prefix-ci? (string-append hostname ":") body)))) + (let ((maybe-val (get-header (request-headers req) 'host))) + (if maybe-val + (let ((val (string-trim maybe-val))) + (or (string-ci=? hostname val) + (string-prefix-ci? (string-append hostname ":") val))) + (http-error (status-code bad-request) "No Host: header")))) handler default-handler)) ;; selects handler according to path-prefix