Corrected bug: SEVAL now generates a response-body even if the request's body isn't
form-url encoded or doesn't contain a program
This commit is contained in:
parent
38f2594ba5
commit
cd22ab11d4
|
@ -56,9 +56,31 @@
|
|||
'()
|
||||
(make-reader-writer-body
|
||||
(lambda (iport oport options)
|
||||
;;still buggy: if the body of the request is not a valid html-form-query
|
||||
;;or does not contain program=<stuff> we answer 200 but
|
||||
;;don't send a body (as read-request-sexp throws an exception)
|
||||
(with-fatal-error-handler
|
||||
|
||||
(lambda (c decline)
|
||||
;; no matter what kind of error (might be a server internal error), we emit this webpage:
|
||||
(emit-prolog oport)
|
||||
(with-tag oport html (xmlnsdecl-attr)
|
||||
(newline oport)
|
||||
(with-tag oport head ()
|
||||
(newline oport)
|
||||
(emit-title oport "No Program")
|
||||
(newline oport))
|
||||
(newline oport)
|
||||
(with-tag oport body ()
|
||||
(newline oport)
|
||||
(emit-header oport 1 "No Program")
|
||||
(newline oport)
|
||||
(with-tag oport p ()
|
||||
(display
|
||||
"No program was found in the body of the request.
|
||||
The request's body must be form-url encoded and contain a \"program=<sexp>\" pair."
|
||||
oport)
|
||||
(newline oport))
|
||||
(newline oport))
|
||||
(newline oport)))
|
||||
|
||||
(let ((sexp (read-request-sexp body-length iport)))
|
||||
(http-syslog (syslog-level debug) "read sexp: ~a" sexp)
|
||||
(emit-prolog oport)
|
||||
|
@ -76,7 +98,7 @@
|
|||
10
|
||||
(receive vals
|
||||
;; Do the computation.
|
||||
(begin (emit-header oport 2 "Output from execution")
|
||||
(begin (emit-header oport 1 "Output from execution")
|
||||
(newline oport)
|
||||
(with-tag oport pre ()
|
||||
(newline oport)
|
||||
|
@ -85,10 +107,10 @@
|
|||
(eval-safely sexp))))
|
||||
|
||||
;; Pretty-print the returned value(s).;; hier noch mal newline rausschreiben?
|
||||
(emit-header oport 2 "Return value(s)")
|
||||
(emit-header oport 1 "Return value(s)")
|
||||
(with-tag oport pre ()
|
||||
(for-each (lambda (val) (p val oport))
|
||||
vals))))))))))))
|
||||
vals)))))))))))))
|
||||
|
||||
|
||||
;;; Read an HTTP request entity body from stdin. The Content-length:
|
||||
|
|
Loading…
Reference in New Issue