Debug CGI
parent
eaa2b43ca7
commit
57c9012d49
|
@ -1,9 +1,9 @@
|
||||||
! Copyright (C) 2007, 2008 Slava Pestov.
|
! Copyright (C) 2007, 2008 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: namespaces kernel assocs io.files io.streams.duplex
|
USING: namespaces kernel assocs io.files io.streams.duplex
|
||||||
combinators arrays io.launcher io http.server.static http.server
|
combinators arrays io.launcher io.encodings.binary io
|
||||||
http accessors sequences strings math.parser fry urls
|
http.server.static http.server http accessors sequences strings
|
||||||
urls.encoding ;
|
math.parser fry urls urls.encoding calendar ;
|
||||||
IN: http.server.cgi
|
IN: http.server.cgi
|
||||||
|
|
||||||
: cgi-variables ( script-path -- assoc )
|
: cgi-variables ( script-path -- assoc )
|
||||||
|
@ -44,14 +44,15 @@ IN: http.server.cgi
|
||||||
: <cgi-process> ( name -- desc )
|
: <cgi-process> ( name -- desc )
|
||||||
<process>
|
<process>
|
||||||
over 1array >>command
|
over 1array >>command
|
||||||
swap cgi-variables >>environment ;
|
swap cgi-variables >>environment
|
||||||
|
1 minutes >>timeout ;
|
||||||
|
|
||||||
: serve-cgi ( name -- response )
|
: serve-cgi ( name -- response )
|
||||||
<raw-response>
|
<raw-response>
|
||||||
200 >>code
|
200 >>code
|
||||||
"CGI output follows" >>message
|
"CGI output follows" >>message
|
||||||
swap '[
|
swap '[
|
||||||
_ output-stream get swap <cgi-process> <process-stream> [
|
_ output-stream get swap <cgi-process> binary <process-stream> [
|
||||||
post-request? [ request get post-data>> raw>> write flush ] when
|
post-request? [ request get post-data>> raw>> write flush ] when
|
||||||
input-stream get swap (stream-copy)
|
input-stream get swap (stream-copy)
|
||||||
] with-stream
|
] with-stream
|
||||||
|
|
Loading…
Reference in New Issue