Add implementation of NAME->STATUS-CODE.

Tag export of STATUS-CODE as :SYNTAX.
This commit is contained in:
sperber 2003-01-10 09:57:41 +00:00
parent 86b0639a7f
commit 5880441b02
2 changed files with 15 additions and 1 deletions

View File

@ -78,6 +78,18 @@
(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])
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Take an http-error condition, and format it into a response to the client.

View File

@ -281,7 +281,8 @@
status-code?
status-code-number
status-code-message
status-code
(status-code :syntax)
name->status-code
make-error-response
make-redirect-response
@ -618,6 +619,7 @@
define-record-types
finite-types
formats
(subset signals (call-error))
httpd-requests
httpd-read-options)
(files (httpd response)))