diff options
author | Arun Isaac | 2022-07-05 01:45:23 +0530 |
---|---|---|
committer | Arun Isaac | 2022-07-05 01:45:23 +0530 |
commit | 2cfd5ea44f179aa5c0667d904e2771e8feffb5b6 (patch) | |
tree | edf7c986aa9eedfaead996cc880d5381f51fda5c | |
parent | e1b0cee919d9439ce47ba9bd8d0ec9c06e0e1c50 (diff) | |
download | tissue-2cfd5ea44f179aa5c0667d904e2771e8feffb5b6.tar.gz tissue-2cfd5ea44f179aa5c0667d904e2771e8feffb5b6.tar.lz tissue-2cfd5ea44f179aa5c0667d904e2771e8feffb5b6.zip |
web: server: Error out on unknown host.
* tissue/web/server.scm: Import (rnrs conditions) and (rnrs
exceptions).
(handler): Error out on unknown host.
-rw-r--r-- | tissue/web/server.scm | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tissue/web/server.scm b/tissue/web/server.scm index 338598e..d07e629 100644 --- a/tissue/web/server.scm +++ b/tissue/web/server.scm @@ -17,6 +17,8 @@ ;;; along with tissue. If not, see <https://www.gnu.org/licenses/>. (define-module (tissue web server) + #:use-module (rnrs conditions) + #:use-module (rnrs exceptions) #:use-module (rnrs io ports) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) @@ -177,11 +179,9 @@ STATE-DIRECTORY." (hostname (match (assq-ref (request-headers request) 'host) ((hostname . _) hostname))) (host-parameters (or (assoc-ref hosts hostname) - ;; If no matching host is found, pick the - ;; first known host. - (match hosts - (((_ . host-parameters) _ ...) - host-parameters))))) + (raise (condition + (make-message-condition "Unknown host") + (make-irritants-condition hostname)))))) (format #t "~a ~a\n" (request-method request) path) |