aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Mills <prologic@shortcircuit.net.au>2016-09-26 22:52:35 +1000
committerJames Mills <prologic@shortcircuit.net.au>2016-09-26 22:52:35 +1000
commitdb99f5876a112c7a8bb78828ac31ba42b047af06 (patch)
tree9f15a06fc80af43f43695e1309a8727debaead4f
parentAdd -url CLI flag for default proxy target and redirect for / (diff)
downloadgopherproxy-db99f5876a112c7a8bb78828ac31ba42b047af06.tar.gz
gopherproxy-db99f5876a112c7a8bb78828ac31ba42b047af06.tar.bz2
gopherproxy-db99f5876a112c7a8bb78828ac31ba42b047af06.zip
Fixed URI handling
-rw-r--r--main.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/main.go b/main.go
index 4ab9579..d1557f6 100644
--- a/main.go
+++ b/main.go
@@ -73,11 +73,16 @@ func proxy(w http.ResponseWriter, req *http.Request) {
73 return 73 return
74 } 74 }
75 75
76 uri, err := url.QueryUnescape(path)
77 if err != nil {
78 io.WriteString(w, fmt.Sprintf("<b>Error:</b><pre>%s</pre>", err))
79 return
80 }
76 res, err := gopher.Get( 81 res, err := gopher.Get(
77 fmt.Sprintf( 82 fmt.Sprintf(
78 "gopher://%s/%s", 83 "gopher://%s/%s",
79 hostport, 84 hostport,
80 url.QueryEscape(path), 85 uri,
81 ), 86 ),
82 ) 87 )
83 if err != nil { 88 if err != nil {