diff --git a/scheme/httpd/response.scm b/scheme/httpd/response.scm index 7c8bf2f..ff6939a 100644 --- a/scheme/httpd/response.scm +++ b/scheme/httpd/response.scm @@ -164,7 +164,7 @@ (if (not (null? args)) (format port "
~%Further Information:~%")) (for-each (lambda (x) (format port "
~%~s~%" x)) args) - (write-string "

\n\n\n" port))) + (format port "

~%~%~%"))) (create-response (lambda (headers writer-proc) @@ -201,7 +201,7 @@ '() (lambda (port options) (generic-title port) - (write-string "The request the client sent could not be understood by this server due to malformed syntax.\n Report to client maintainer.\n" port) + (format port "The request the client sent could not be understood by this server due to malformed syntax.~% Report to client maintainer.~%") (close-html port extras)))) ;; This error response requires one arg: @@ -227,7 +227,7 @@ (list (cons 'WWW-Authenticate (car extras))) (lambda (port options) (title-html port "Authentication Required") - (write-string "Client not authentication-capable or authentication failed.\n" port) + (format port "Client not authentication-capable or authentication failed.~%") (close-html port (cdr extras))))) ((eq? code (status-code forbidden)) @@ -235,7 +235,7 @@ '() (lambda (port options) (title-html port "Request not allowed.") - (write-string "The request the client sent is not allowed.\n Retrying won't help.\n" port) + (format port "The request the client sent is not allowed.~% Retrying won't help.~%") (close-html port extras)))) ((eq? code (status-code not-found)) @@ -243,7 +243,7 @@ '() (lambda (port options) (title-html port "Resource not found") - (format port "The requested resource ~A was not found on this server.\n" + (format port "The requested resource ~A was not found on this server.~%" (http-url->string (request-url req))) (close-html port extras)))) @@ -262,7 +262,7 @@ '() (lambda (port options) (generic-title port) - (format port "This server does not recognize or does not implement the requested method \"~A\".~%" + (format port "This server does not recognize or does not implement the requested method ~A.~%" (request-method req)) (close-html port extras)))) @@ -274,13 +274,12 @@ (format port "This server received an invalid response from the upstream server it accessed in attempting to fulfill the request.~%") (close-html port extras))))))) + (define (title-html out message) ;;produce valid XHTML 1.0 Strict - (write-string - " - - \n" out) - (format out "~%~%~A~%~%~%~%" message) + (emit-prolog out) + (emit-tag out 'html xmlnsdecl-attr) + (format out "~%~%~%~A~%~%~%" message) (format out "~%

~A

~%

~%" message)) ;; Creates a redirect response. The server will serve the new file