all repos — flounder @ 422f8d44a496cf7d701c731615c8c6c043f3a9da

A small site builder for the Gemini protocol

remove port number from IP logs gemini
alex wennerberg alex@alexwennerberg.com
Sat, 02 Jan 2021 10:58:05 -0800
commit

422f8d44a496cf7d701c731615c8c6c043f3a9da

parent

13bb0d3c427d66d8d1e717fd5a4bc59bac5088bf

1 files changed, 6 insertions(+), 1 deletions(-)

jump to
M log.golog.go

@@ -149,7 +149,12 @@

// Anonymize user and IP? func logGemini(r *gmi.Request) { - line := fmt.Sprintf("gemini %s - [%s] %s %s\n", r.RemoteAddr.String(), + ipAddr := r.RemoteAddr.String() + host, _, err := net.SplitHostPort(ipAddr) + if err != nil { + host = ipAddr + } + line := fmt.Sprintf("gemini %s - [%s] %s %s\n", host, time.Now().Format("02/Jan/2006:15:04:05 -0700"), r.URL.Host, r.URL.Path)