http: Log incoming connections and requests.
* src/web/server/fiberized.scm (socket-loop): Add 'log-message' call. * src/cuirass/http.scm (url-handler): Likewise.
This commit is contained in:
parent
77769c29e7
commit
1af31c3200
|
@ -121,6 +121,9 @@
|
|||
404
|
||||
(format #f "The build log of derivation ~a is not available." drv))))
|
||||
|
||||
(log-message "~a ~a" (request-method request)
|
||||
(uri-path (request-uri request)))
|
||||
|
||||
(match (request-path-components request)
|
||||
(((or "jobsets" "specifications") . rest)
|
||||
(respond-json (object->json-string (car (db-get-specifications db)))))
|
||||
|
|
|
@ -40,7 +40,8 @@
|
|||
#:use-module (ice-9 binary-ports)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (fibers)
|
||||
#:use-module (fibers channels))
|
||||
#:use-module (fibers channels)
|
||||
#:use-module (cuirass logging))
|
||||
|
||||
(define (make-default-socket family addr port)
|
||||
(let ((sock (socket PF_INET SOCK_STREAM 0)))
|
||||
|
@ -142,6 +143,9 @@
|
|||
(let loop ()
|
||||
(match (accept socket (logior SOCK_NONBLOCK SOCK_CLOEXEC))
|
||||
((client . sockaddr)
|
||||
(log-message "HTTP connection from ~a"
|
||||
(inet-ntop (sockaddr:fam sockaddr)
|
||||
(sockaddr:addr sockaddr)))
|
||||
(spawn-fiber (lambda () (client-loop client have-request))
|
||||
#:parallel? #t)
|
||||
(loop)))))
|
||||
|
|
Loading…
Reference in New Issue