akas for localhost

dev-nonsettable
Matthew Butterick 5 years ago
parent c6411231c1
commit 53ffc88be0

@ -58,15 +58,16 @@
;; print message to console about a request
(define/contract (logger req)
(request? . -> . void?)
(define localhost-client "::1")
(define localhost-names '("::1" "fe80::1%lo0" "127.0.0.1"))
(define url-string (url->string (request-uri req)))
(unless (ends-with? url-string "favicon.ico")
(message (match url-string
[(regexp #rx"/$") (string-append url-string " directory default page")]
[_ (string-replace url-string (setup:main-pagetree) " dashboard")])
(match (request-client-ip req)
[(== localhost-client) ""]
[client (format "from ~a" client)]))))
[client #:when (not (member client localhost-names))
(format "from ~a" client)]
[_ ""]))))
;; pass string args to route, then
;; package route into right format for web server

@ -1 +1 @@
1587564275
1587667269

Loading…
Cancel
Save