Fix handling of "npg-" scripts by using make-nph-response.

This commit is contained in:
mainzelm 2003-01-15 14:03:30 +00:00
parent 7170593056
commit 7e274597a4
1 changed files with 15 additions and 16 deletions

View File

@ -121,14 +121,6 @@
(cond
((or (string=? request-method "GET")
(string=? request-method "POST")) ; Could do others also.
(if nph?
(let ((stat (wait (fork doit))))
(if (not (zero? stat))
(make-error-response
(status-code bad-request) req
(format #f "Could not execute CGI script ~a."
filename))
stat)) ;; FIXME! must return http-response object!
(case (file-not-executable? filename)
((search-denied permission)
(make-error-response (status-code forbidden) req
@ -137,6 +129,8 @@
(make-error-response (status-code not-found) req
"File or directory doesn't exist."))
(else
(if nph?
(cgi-make-nph-response (run/port* doit))
(cgi-make-response (run/port* doit) path req)))))
(else
@ -275,6 +269,11 @@
(close-input-port script-port)))))))
(define (cgi-make-nph-response script-port)
(make-nph-response
(make-writer-body (lambda (out options)
(copy-inport->outport script-port out)))))
(define (uri-has-protocol? loc)
(receive (proto path search frag)
(parse-uri loc)