Add implementation of NAME->STATUS-CODE.
Tag export of STATUS-CODE as :SYNTAX.
This commit is contained in:
parent
86b0639a7f
commit
5880441b02
|
@ -78,6 +78,18 @@
|
||||||
|
|
||||||
(redirect -301 "Internal redirect")))
|
(redirect -301 "Internal redirect")))
|
||||||
|
|
||||||
|
(define (name->status-code name)
|
||||||
|
(if (not (symbol? name))
|
||||||
|
(call-error name->status-code (list name))
|
||||||
|
(let loop ((i 0))
|
||||||
|
(cond ((= i (vector-length status-codes))
|
||||||
|
#f)
|
||||||
|
((eq? name
|
||||||
|
(status-code-name (vector-ref status-codes i)))
|
||||||
|
(vector-ref status-codes i))
|
||||||
|
(else
|
||||||
|
(loop (+ i 1)))))))
|
||||||
|
|
||||||
;;; (make-error-response status-code req [message . extras])
|
;;; (make-error-response status-code req [message . extras])
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;; Take an http-error condition, and format it into a response to the client.
|
;;; Take an http-error condition, and format it into a response to the client.
|
||||||
|
|
|
@ -281,7 +281,8 @@
|
||||||
status-code?
|
status-code?
|
||||||
status-code-number
|
status-code-number
|
||||||
status-code-message
|
status-code-message
|
||||||
status-code
|
(status-code :syntax)
|
||||||
|
name->status-code
|
||||||
|
|
||||||
make-error-response
|
make-error-response
|
||||||
make-redirect-response
|
make-redirect-response
|
||||||
|
@ -618,6 +619,7 @@
|
||||||
define-record-types
|
define-record-types
|
||||||
finite-types
|
finite-types
|
||||||
formats
|
formats
|
||||||
|
(subset signals (call-error))
|
||||||
httpd-requests
|
httpd-requests
|
||||||
httpd-read-options)
|
httpd-read-options)
|
||||||
(files (httpd response)))
|
(files (httpd response)))
|
||||||
|
|
Loading…
Reference in New Issue