Better logging

db4
Slava Pestov 2008-09-28 17:56:44 -05:00
parent a550b17b16
commit d3423bec4f
4 changed files with 10 additions and 4 deletions

View File

@ -3,15 +3,13 @@
USING: accessors kernel combinators math namespaces make
assocs sequences splitting sorting sets debugger
strings vectors hashtables quotations arrays byte-arrays
math.parser calendar calendar.format present
math.parser calendar calendar.format present urls logging
io io.encodings io.encodings.iana io.encodings.binary
io.encodings.8-bit
unicode.case unicode.categories qualified
urls
http.parsers ;
EXCLUDE: fry => , ;
@ -98,6 +96,8 @@ TUPLE: cookie name value version comment path domain expires max-age http-only s
drop
] { } make ;
\ parse-cookie DEBUG add-input-logging
: check-cookie-string ( string -- string' )
dup "=;'\"\r\n" intersect empty?
[ "Bad cookie name or value" throw ] unless ;

View File

@ -2,7 +2,7 @@
! See http://factorcode.org/license.txt for BSD license.
USING: combinators.short-circuit math math.order math.parser
kernel sequences sequences.deep peg peg.parsers assocs arrays
hashtables strings unicode.case namespaces make ascii ;
hashtables strings unicode.case namespaces make ascii logging ;
IN: http.parsers
: except ( quot -- parser )
@ -61,6 +61,8 @@ PEG: parse-request-line ( string -- triple )
'space' ,
] seq* just ;
\ parse-request-line DEBUG add-input-logging
: 'text' ( -- parser )
[ ctl? ] except ;

View File

@ -78,6 +78,8 @@ M: threaded-server handle-client* handler>> call ;
[ timeout>> timeouts ] [ handle-client* ] bi
] with-stream ;
\ handle-client ERROR add-error-logging
: thread-name ( server-name addrspec -- string )
unparse-short " connection from " swap 3append ;

View File

@ -27,8 +27,10 @@ M: ssl-handle handle-fd file>> handle-fd ;
{
{ SSL_ERROR_NONE [ 2drop f ] }
{ SSL_ERROR_WANT_READ [ 2drop +input+ ] }
{ SSL_ERROR_WANT_ACCEPT [ 2drop +input+ ] }
{ SSL_ERROR_WANT_WRITE [ 2drop +output+ ] }
{ SSL_ERROR_SYSCALL [ syscall-error ] }
{ SSL_ERROR_ZERO_RETURN [ (ssl-error) ] }
{ SSL_ERROR_SSL [ (ssl-error) ] }
} case ;