From b15edb1e6910a8a2b4994d8225f2ec5097e648ab Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Fri, 1 Jul 2022 01:25:58 +0530 Subject: web: server: Make CSS a host-specific parameter. * bin/tissue (tissue-run-web): Pass CSS as a host-specific parameter. * tissue/web/server.scm (handler): Remove css argument. Accept CSS as a host-specific parameter. (start-web-server): Remove css argument. --- tissue/web/server.scm | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'tissue') diff --git a/tissue/web/server.scm b/tissue/web/server.scm index 89e8104..be783db 100644 --- a/tissue/web/server.scm +++ b/tissue/web/server.scm @@ -165,12 +165,11 @@ operators " (string-split query #\&)) '())) -(define (handler request body hosts xapian-index css) +(define (handler request body hosts xapian-index) "Handle web REQUEST with BODY and return two values---the response headers and body. -See `start-web-server' for documentation of HOSTS, XAPIAN-INDEX and -CSS." +See `start-web-server' for documentation of HOSTS and XAPIAN-INDEX." (let ((path (uri-path (request-uri request))) (parameters (query-parameters (uri-query (request-uri request)))) (host-parameters (or (assoc-ref hosts @@ -209,19 +208,19 @@ CSS." mset)) search-query (MSet-get-matches-estimated mset) - css)))))))) + (assq-ref host-parameters 'css))))))))) (else (values (build-response #:code 404) (string-append "Resource not found: " (uri->string (request-uri request)))))))))) -(define (start-web-server socket-address hosts xapian-index css) +(define (start-web-server socket-address hosts xapian-index) "Start web server listening on SOCKET-ADDRESS. HOSTS is an association list mapping host names to another association list containing parameters for that host. XAPIAN-INDEX is the path to the xapian database relative to the top-level of the git -repository. CSS is a URI to a stylesheet." +repository." (format (current-error-port) "Tissue web server listening on ~a~%" (cond @@ -245,7 +244,7 @@ repository. CSS is a URI to a stylesheet." ;; variable each time so as to support live hacking. ((module-ref (resolve-module '(tissue web server)) 'handler) - request body hosts xapian-index css)) + request body hosts xapian-index)) 'http (cond ;; IPv4 or IPv6 address -- cgit v1.2.3