+ Moved http-error from the forked process into the server process.
+ Set stdin and stdout to the current-in/output-port after forking.
This commit is contained in:
parent
612ca1e0ad
commit
aa2f04195e
|
@ -106,10 +106,9 @@
|
|||
(env (cgi-env req bin-dir (cdr path)))
|
||||
|
||||
(doit (lambda ()
|
||||
(apply exec/env filename env argv)
|
||||
(http-error http-reply/bad-request req
|
||||
(format #f "Could not execute CGI script ~a."
|
||||
filename)))))
|
||||
(dup->inport (current-input-port) 0)
|
||||
(dup->outport (current-output-port) 1)
|
||||
(apply exec/env filename env argv))))
|
||||
|
||||
(http-log "search: ~s, argv: ~s~%" search argv)
|
||||
(let ((request-method (request:method req)))
|
||||
|
@ -117,7 +116,12 @@
|
|||
((or (string=? request-method "GET")
|
||||
(string=? request-method "POST")) ; Could do others also.
|
||||
(if nph?
|
||||
(wait (fork doit))
|
||||
(let ((stat (wait (fork doit))))
|
||||
(if (not (zero? stat))
|
||||
(http-error http-reply/bad-request req
|
||||
(format #f "Could not execute CGI script ~a."
|
||||
filename))
|
||||
stat))
|
||||
(cgi-send-reply (run/port* doit) req)))
|
||||
|
||||
(else (http-error http-reply/method-not-allowed req)))))
|
||||
|
|
Loading…
Reference in New Issue