web-redirect/temporary!

This commit is contained in:
Tony Garnock-Jones 2016-11-23 15:32:44 +13:00
parent 4b99b629df
commit 3ce8bc380b
1 changed files with 13 additions and 0 deletions

View File

@ -30,6 +30,7 @@
web-respond/bytes!
web-respond/string!
web-respond/xexpr!
web-redirect/temporary!
append-url-path
@ -160,6 +161,18 @@
(bytes-append preamble
(string->bytes/utf-8 (xexpr->string body-xexpr)))))
(define (web-redirect/temporary! id location
#:content-type [content-type "text/html"]
#:body [body `(html (body (a ((href ,location))
"Moved to " ,location)))])
(web-respond/xexpr! id
#:header (make-web-response-header
#:code 303
#:message #"Moved"
#:headers (list (cons 'location location)
(cons 'content-type content-type)))
body))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define web-server-max-waiting (make-parameter 511)) ;; sockets