]> Sergey Matveev's repositories - godlighty.git/blobdiff - rc/cgi.go
Better URL escaping in output
[godlighty.git] / rc / cgi.go
index e17935a795af8491957492564b24fc0bf48ea2db..cce9aeec6a18e03192f2a3caae020518cf257107 100644 (file)
--- a/rc/cgi.go
+++ b/rc/cgi.go
@@ -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"),
        )