Prevent log interaction with a lock.
Don't do a DNS lookup for log entries.
This commit is contained in:
parent
5e1193c60a
commit
24214819dc
|
@ -52,6 +52,7 @@
|
|||
|
||||
(define *http-log?* #t)
|
||||
(define *http-log-port* #f)
|
||||
(define *http-log-lock* (make-lock))
|
||||
|
||||
(define (init-http-log!)
|
||||
(set! *http-log-port* (current-error-port)))
|
||||
|
@ -59,9 +60,10 @@
|
|||
(define (http-log fmt . args)
|
||||
(if *http-log?*
|
||||
(begin
|
||||
(obtain-lock *http-log-lock*)
|
||||
(apply format *http-log-port* fmt args)
|
||||
(force-output *http-log-port*)
|
||||
)))
|
||||
(release-lock *http-log-lock*))))
|
||||
|
||||
|
||||
;;; (httpd path-handler [port server-root-dir])
|
||||
|
@ -188,9 +190,13 @@
|
|||
|
||||
;; Blat out some logging info.
|
||||
(if *http-log?*
|
||||
(let* ((addr (socket-remote-address sock))
|
||||
(host (host-name-or-ip addr)))
|
||||
(http-log "~a: ~a~%" host line)))
|
||||
(call-with-values
|
||||
(lambda ()
|
||||
(socket-address->internet-address (socket-remote-address sock)))
|
||||
(lambda (host-address service-port)
|
||||
(http-log "~a: ~a~%"
|
||||
(format-internet-host-address host-address)
|
||||
line))))
|
||||
|
||||
(if (eof-object? line)
|
||||
(fatal-syntax-error "EOF while parsing request.")
|
||||
|
|
Loading…
Reference in New Issue