diff options
author | Ludovic Courtès <ludo@gnu.org> | 2018-01-26 11:22:31 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2018-01-26 11:23:07 +0100 |
commit | 1af31c3200ecae9c4c95d7158a0e5986b1705b3c (patch) | |
tree | 2eba8d6a93209593b9aa1317d9ba52b02179f43b | |
parent | 77769c29e787944eb01fdc016a2ac50b1e4655f7 (diff) | |
download | cuirass-1af31c3200ecae9c4c95d7158a0e5986b1705b3c.tar cuirass-1af31c3200ecae9c4c95d7158a0e5986b1705b3c.tar.gz |
http: Log incoming connections and requests.
* src/web/server/fiberized.scm (socket-loop): Add 'log-message' call.
* src/cuirass/http.scm (url-handler): Likewise.
-rw-r--r-- | src/cuirass/http.scm | 3 | ||||
-rw-r--r-- | src/web/server/fiberized.scm | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/cuirass/http.scm b/src/cuirass/http.scm index 3775298..9eeb9e2 100644 --- a/src/cuirass/http.scm +++ b/src/cuirass/http.scm @@ -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))))) diff --git a/src/web/server/fiberized.scm b/src/web/server/fiberized.scm index 4758d00..25a410a 100644 --- a/src/web/server/fiberized.scm +++ b/src/web/server/fiberized.scm @@ -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))))) |