From 01ac42bc111b9a5fac36a35375f08b087f0101e6 Mon Sep 17 00:00:00 2001 From: Andrea Spacca Date: Sun, 21 Nov 2021 21:06:52 +0100 Subject: [PATCH] revert query set, remove debug --- main.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/main.go b/main.go index 901378f..a27454f 100644 --- a/main.go +++ b/main.go @@ -117,7 +117,7 @@ func (*requesthandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { path := req.URL.EscapedPath() path = strings.Replace(path, path_prefix, "", 1) - + path = strings.Replace(path, "/ggpht", "", 1) path = strings.Replace(path, "/i/", "/", 1) @@ -127,23 +127,15 @@ func (*requesthandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { log.Panic(err) } - proxyURL.RawQuery = "" - for k, v := range q { - for _, vv := range v { - proxyURL.Query().Set(k, vv) - } - } + proxyURL.RawQuery = q.Encode() if strings.HasSuffix(proxyURL.EscapedPath(), "maxres.jpg") { proxyURL.Path = getBestThumbnail(proxyURL.EscapedPath()) } request, err := http.NewRequest(req.Method, proxyURL.String(), nil) - fmt.Println(proxyURL.Query().Encode()) - fmt.Println(proxyURL.String()) copyHeaders(req.Header, request.Header) request.Header.Set("User-Agent", ua) - fmt.Printf("User-Agent: %s\n", ua) if err != nil { log.Panic(err) @@ -205,7 +197,6 @@ func copyHeaders(from http.Header, to http.Header) { // Loop over all values for the name. for _, value := range values { to.Set(name, value) - fmt.Printf("%s: %s\n", name, value) } } }