From db826a9c1f89f895a0f3e01e35e6b9811dc5b668 Mon Sep 17 00:00:00 2001 From: vibr Date: Thu, 14 Apr 2005 15:18:54 +0000 Subject: [PATCH] add comment explaining why the concept of http-reader-writer-body (which is used by the seval-handler only) doesn't work --- scheme/httpd/response.scm | 9 +++++++++ scheme/httpd/seval.scm | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/scheme/httpd/response.scm b/scheme/httpd/response.scm index 5ac0d48..104800e 100644 --- a/scheme/httpd/response.scm +++ b/scheme/httpd/response.scm @@ -46,6 +46,15 @@ writer-body? (proc writer-body-proc)) +;; the concept of http-reader-writer-body doesn't work: status-line +;; and headers of the response (i.e. the whole http-response record) +;; have to be built _before_ we have seen the entity-body of the +;; request. (Not until display-http-body hands over the iport to +;; reader-writer-body the entity-body can be read in). If the +;; entity-body is erroneous or if we encounter a server internal error +;; while reading in the entity-body we are not able to send an +;; appropriate response. (At that point of time we already sent +;; status-line and response-headers!) (define-record-type http-reader-writer-body :http-reader-writer-body (make-reader-writer-body proc) reader-writer-body? diff --git a/scheme/httpd/seval.scm b/scheme/httpd/seval.scm index d06bd13..72cbf0a 100644 --- a/scheme/httpd/seval.scm +++ b/scheme/httpd/seval.scm @@ -9,6 +9,10 @@ ;;; This is really just an handler example demonstrating how to upload code ;;; into the server. +;;; Besides, this handler has always been broken because it makes use +;;; of the concept of http-reader-writer-body which is broken +;;; itself. See response.scm. + ;;; (do/timeout secs thunk) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Run THUNK, and gun it down if it hasn't finished in SECS seconds. @@ -54,7 +58,7 @@ (time) "text/html" '() - (make-reader-writer-body + (make-reader-writer-body ;; see response.scm for an explanation why the concept of http-reader-writer-body doesn't work (lambda (iport oport options) (with-fatal-error-handler