]> Sergey Matveev's repositories - godlighty.git/blobdiff - rc/cgi.go
Raised copyright years
[godlighty.git] / rc / cgi.go
index e17935a795af8491957492564b24fc0bf48ea2db..f87335e3812198632a45db9dcd8b5fce414c7d47 100644 (file)
--- a/rc/cgi.go
+++ b/rc/cgi.go
@@ -1,6 +1,6 @@
 /*
 godlighty -- highly-customizable HTTP, HTTP/2, HTTPS server
-Copyright (C) 2021 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2021-2022 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -26,13 +26,13 @@ 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())
        }
+       wc := &godlighty.CountResponseWriter{ResponseWriter: w}
        h.ServeHTTP(wc, r)
        fmt.Printf("%s %s \"%s %+q %s\" %d %d \"%s\"\n",
-               r.RemoteAddr, host, r.Method, r.URL.Path, r.Proto,
+               r.RemoteAddr, host, r.Method, godlighty.PathWithQuery(r.URL), r.Proto,
                wc.Status, wc.Size,
                r.Header.Get("User-Agent"),
        )