From 5e14a326b981504112fc9e1f89c7a59549f9810b Mon Sep 17 00:00:00 2001 From: vibr Date: Thu, 29 Jul 2004 16:08:30 +0000 Subject: [PATCH] adapt make-error-response: - no URI header field in 1.1 - new 30x status codes in 1.1 --- scheme/httpd/response.scm | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/scheme/httpd/response.scm b/scheme/httpd/response.scm index 9f5aca5..a2e6173 100644 --- a/scheme/httpd/response.scm +++ b/scheme/httpd/response.scm @@ -173,20 +173,22 @@ (make-writer-body writer-proc))))) (cond - ;; This error response requires two args: message is the new URI: field, - ;; and the first EXTRA is the older Location: field. - ((or (eq? code (status-code moved-temp)) - (eq? code (status-code moved-perm))) + ;; This error response requires one arg: + ;; message is the Location field. + ;; the Location field's field value must be a single absolute URI + ((or (eq? code (status-code found));302 + (eq? code (status-code see-other));303 + (eq? code (status-code temp-redirect));307 + (eq? code (status-code moved-perm)));301 (create-response - (list (cons 'uri message) - (cons 'location (car extras))) + (list (cons 'location message)) (lambda (port options) (title-html port "Document moved") (format port "This document has ~A moved to a new location.~%" - (if (eq? code (status-code moved-temp)) - "temporarily" - "permanently") + (if (eq? code (status-code moved-perm)) + "permanently" + "temporarily") message) (close-html port)))) @@ -290,7 +292,7 @@ response of a gateway.~%") ;; the browser won't notice the redirect. Thus, it will keep the ;; original URL. For "real" redirections, use ;; (make-error-response (status-code moved-perm) req -;; "new-location" "new-location"). +;; "new-location"). (define (make-redirect-response new-location) (make-response (status-code redirect)