+ 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)))
|
(env (cgi-env req bin-dir (cdr path)))
|
||||||
|
|
||||||
(doit (lambda ()
|
(doit (lambda ()
|
||||||
(apply exec/env filename env argv)
|
(dup->inport (current-input-port) 0)
|
||||||
(http-error http-reply/bad-request req
|
(dup->outport (current-output-port) 1)
|
||||||
(format #f "Could not execute CGI script ~a."
|
(apply exec/env filename env argv))))
|
||||||
filename)))))
|
|
||||||
|
|
||||||
(http-log "search: ~s, argv: ~s~%" search argv)
|
(http-log "search: ~s, argv: ~s~%" search argv)
|
||||||
(let ((request-method (request:method req)))
|
(let ((request-method (request:method req)))
|
||||||
|
@ -117,7 +116,12 @@
|
||||||
((or (string=? request-method "GET")
|
((or (string=? request-method "GET")
|
||||||
(string=? request-method "POST")) ; Could do others also.
|
(string=? request-method "POST")) ; Could do others also.
|
||||||
(if nph?
|
(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)))
|
(cgi-send-reply (run/port* doit) req)))
|
||||||
|
|
||||||
(else (http-error http-reply/method-not-allowed req)))))
|
(else (http-error http-reply/method-not-allowed req)))))
|
||||||
|
|
Loading…
Reference in New Issue