]> Sergey Matveev's repositories - godlighty.git/commitdiff
TLSREMOTEDN
authorSergey Matveev <stargrave@stargrave.org>
Fri, 8 Oct 2021 17:15:55 +0000 (20:15 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Fri, 8 Oct 2021 17:26:43 +0000 (20:26 +0300)
rc/cgi.go

index 42363e3d03d63c746bd8a0aa51dbd2dcbf420531..8dab80f9eb900a290b494c8d117d97ae162d7e4e 100644 (file)
--- a/rc/cgi.go
+++ b/rc/cgi.go
@@ -27,6 +27,9 @@ import (
 
 func RunCGIAndLog(host string, w http.ResponseWriter, r *http.Request, h *cgi.Handler) {
        wc := &godlighty.CountResponseWriter{ResponseWriter: w}
+       if r.TLS != nil && len(r.TLS.PeerCertificates) > 0 {
+               h.Env = append(h.Env, "TLSREMOTEDN="+r.TLS.PeerCertificates[0].Subject.String())
+       }
        h.ServeHTTP(wc, r)
        fmt.Printf("%s %s \"%s %s %s\" %d %d \"%s\"\n",
                r.RemoteAddr, host, r.Method, r.URL.Path, r.Proto,