[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Ludovic Courtès |
Date: |
Fri, 26 Jan 2018 09:24:03 -0500 (EST) |
branch: master
commit 1af31c3200ecae9c4c95d7158a0e5986b1705b3c
Author: Ludovic Courtès <address@hidden>
Date: Fri Jan 26 11:22:31 2018 +0100
http: Log incoming connections and requests.
* src/web/server/fiberized.scm (socket-loop): Add 'log-message' call.
* src/cuirass/http.scm (url-handler): Likewise.
---
src/cuirass/http.scm | 3 +++
src/web/server/fiberized.scm | 6 +++++-
2 files changed, 8 insertions(+), 1 deletion(-)
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)))))
- master updated (77769c2 -> 39cf6e6), Ludovic Courtès, 2018/01/26
- [no subject], Ludovic Courtès, 2018/01/26
- [no subject], Ludovic Courtès, 2018/01/26
- [no subject], Ludovic Courtès, 2018/01/26
- [no subject],
Ludovic Courtès <=
- [no subject], Ludovic Courtès, 2018/01/26
- [no subject], Ludovic Courtès, 2018/01/26
- [no subject], Ludovic Courtès, 2018/01/26
- [no subject], Ludovic Courtès, 2018/01/26
- [no subject], Ludovic Courtès, 2018/01/26
- [no subject], Ludovic Courtès, 2018/01/26