make-host-name-handler now uses get-header from sunet-utilities.scm
This commit is contained in:
parent
8cf841bad3
commit
ef48e4e5ae
|
@ -48,9 +48,12 @@
|
||||||
(make-predicate-handler
|
(make-predicate-handler
|
||||||
(lambda (path req)
|
(lambda (path req)
|
||||||
;; we expect only one host-header-field
|
;; we expect only one host-header-field
|
||||||
(let ((body (string-trim (get-header (request-headers req) 'host))))
|
(let ((maybe-val (get-header (request-headers req) 'host)))
|
||||||
(or (string-ci=? hostname body)
|
(if maybe-val
|
||||||
(string-prefix-ci? (string-append hostname ":") body))))
|
(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))
|
handler default-handler))
|
||||||
|
|
||||||
;; selects handler according to path-prefix
|
;; selects handler according to path-prefix
|
||||||
|
|
Loading…
Reference in New Issue