diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-08-09 15:44:44 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-08-09 16:27:31 +0200 |
commit | e2a602d16dfad5325960dec0a16ee2b88560a36f (patch) | |
tree | e076260a831ef3471f45b07d516410eb891299d7 /module/server | |
parent | Can create events with åäö again. (diff) | |
download | calp-e2a602d16dfad5325960dec0a16ee2b88560a36f.tar.gz calp-e2a602d16dfad5325960dec0a16ee2b88560a36f.tar.xz |
Add basic (semi broken) paginator to HTML search.
Diffstat (limited to '')
-rw-r--r-- | module/server/macro.scm | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/module/server/macro.scm b/module/server/macro.scm index 99272a75..3fdfd06b 100644 --- a/module/server/macro.scm +++ b/module/server/macro.scm @@ -75,25 +75,24 @@ (r:path (uri-path r:uri)) (r:query (uri-query r:uri)) (r:fragment (uri-fragment r:uri))) - - (call-with-values (lambda () - (call/ec (lambda (return) - (apply - (cond ,@(map generate-case routes) - (else (lambda* _ (return (build-response #:code 404) - "404 Not Fonud")))) - (append - (parse-query r:query) + (call/ec (lambda (return) + (apply + (cond ,@(map generate-case routes) + (else (lambda* _ (return (build-response #:code 404) + "404 Not Fonud")))) + (append + (parse-query r:query) - (let ((content-type (assoc-ref r:headers 'content-type))) - (when content-type - (let ((type (car content-type)) - (args (cdr content-type))) - (when (eq? type 'application/x-www-form-urlencoded) - (let ((encoding (or (assoc-ref args 'encoding) "UTF-8"))) - (parse-query (bytevector->string body encoding) - encoding))))))))))) - (lambda* (a b #:optional new-state) - (values a b (or new-state state)))))))) + (let ((content-type (assoc-ref r:headers 'content-type))) + (when content-type + (let ((type (car content-type)) + (args (cdr content-type))) + (when (eq? type 'application/x-www-form-urlencoded) + (let ((encoding (or (assoc-ref args 'encoding) "UTF-8"))) + (parse-query (bytevector->string body encoding) + encoding))))))))))) + (case-lambda ((headers body new-state) (values headers body new-state)) + ((headers body) (values headers body state)) + ((headers) (values headers "" state)))))))) |