Fix http server
parent
e7ec34050b
commit
2d381ed84e
|
@ -25,7 +25,7 @@ M: template-lexer skip-word
|
|||
{
|
||||
{ [ 2dup nth CHAR: " = ] [ drop 1+ ] }
|
||||
{ [ 2dup swap tail-slice "%>" head? ] [ drop 2 + ] }
|
||||
{ [ t ] [ [ blank? ] skip ] }
|
||||
{ [ t ] [ f skip ] }
|
||||
} cond
|
||||
] change-column ;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ SYMBOL: log-stream
|
|||
|
||||
: with-log-file ( file quot -- )
|
||||
>r <file-appender> r>
|
||||
[ with-log-stream ] with-disposal ; inline
|
||||
[ with-log-stream ] curry with-disposal ; inline
|
||||
|
||||
: with-log-stdio ( quot -- )
|
||||
stdio get swap with-log-stream ;
|
||||
|
@ -47,11 +47,11 @@ SYMBOL: log-stream
|
|||
dup log-client
|
||||
[ swap with-stream ] 2curry concurrency:spawn drop ; inline
|
||||
|
||||
: accept-loop ( server quot -- server quot )
|
||||
: accept-loop ( server quot -- )
|
||||
[ swap accept with-client ] 2keep accept-loop ; inline
|
||||
|
||||
: server-loop ( server quot -- )
|
||||
[ accept-loop ] compose with-disposal ; inline
|
||||
[ accept-loop ] curry with-disposal ; inline
|
||||
|
||||
: spawn-server ( addrspec quot -- )
|
||||
"Waiting for connections on " pick unparse append
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
! Copyright (C) 2007 Slava Pestov.
|
||||
! Copyright (C) 2007, 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: namespaces kernel assocs io.files combinators
|
||||
arrays io.launcher io http.server.responders webapps.file
|
||||
sequences strings math.parser ;
|
||||
sequences strings math.parser unicode.case ;
|
||||
IN: webapps.cgi
|
||||
|
||||
SYMBOL: cgi-root
|
||||
|
@ -31,7 +31,7 @@ SYMBOL: cgi-root
|
|||
|
||||
"method" get >upper "REQUEST_METHOD" set
|
||||
"raw-query" get "QUERY_STRING" set
|
||||
"Cookie" header-param "HTTP_COOKIE" set
|
||||
"Cookie" header-param "HTTP_COOKIE" set
|
||||
|
||||
"User-Agent" header-param "HTTP_USER_AGENT" set
|
||||
"Accept" header-param "HTTP_ACCEPT" set
|
||||
|
|
Loading…
Reference in New Issue