]> Sergey Matveev's repositories - godlighty.git/blobdiff - rc/example.cfg/proxied-host.go
Better URL escaping in output
[godlighty.git] / rc / example.cfg / proxied-host.go
index 1ad0db6a0bda6bf39f1e8c539ae167e9c7a7af6e..a11f728b61cea2e4c5ca33deea457e3acf0cfabf 100644 (file)
@@ -19,9 +19,9 @@ func init() {
                                r.Host = host
                                resp, err := http.DefaultClient.Do(r)
                                if err != nil {
-                                       fmt.Printf("%s %s \"%s %s %s\" %d \"%s\" \"%s\"\n",
-                                               r.RemoteAddr, host, r.Method, r.URL.Path, r.Proto,
-                                               http.StatusBadGateway, err.Error(),
+                                       fmt.Printf("%s %s \"%s %+q %s\" %d \"%s\" \"%s\"\n",
+                                               r.RemoteAddr, host, r.Method, godlighty.PathWithQuery(r.URL),
+                                               r.Proto, http.StatusBadGateway, err.Error(),
                                                r.Header.Get("User-Agent"),
                                        )
                                        http.Error(w, err.Error(), http.StatusBadGateway)
@@ -35,9 +35,9 @@ func init() {
                                w.WriteHeader(resp.StatusCode)
                                size, _ := io.Copy(w, resp.Body)
                                resp.Body.Close()
-                               fmt.Printf("%s %s \"%s %s %s\" %d %d \"%s\"\n",
-                                       r.RemoteAddr, host, r.Method, r.URL.Path, r.Proto,
-                                       resp.StatusCode, size,
+                               fmt.Printf("%s %s \"%s %+q %s\" %d %d \"%s\"\n",
+                                       r.RemoteAddr, host, r.Method, godlighty.PathWithQuery(r.URL),
+                                       r.Proto, resp.StatusCode, size,
                                        r.Header.Get("User-Agent"),
                                )
                                return true