gopherproxy

(mirror) Gopher (RFC 1436) Web Proxy
git clone git://tx.god.jp/gopherproxy.git
Log | Files | Refs | LICENSE

commit 4c66260eecfecc531c526df40881ef51cf82ef46
parent db99f5876a112c7a8bb78828ac31ba42b047af06
Author: James Mills <prologic@shortcircuit.net.au>
Date:   Mon, 26 Sep 2016 23:21:56 +1000

Don't include :port if the server is onthe default port 70

Diffstat:
main.go | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/main.go b/main.go @@ -44,10 +44,16 @@ func renderDirectory(w http.ResponseWriter, tpl *template.Template, hostport str if strings.HasPrefix(x.Selector, "URL:") { tr.Link = template.URL(x.Selector[4:]) } else { + var hostport string + if x.Port == 70 { + hostport = x.Host + } else { + hostport = fmt.Sprintf("%s:%d", x.Host, x.Port) + } tr.Link = template.URL( fmt.Sprintf( "/%s/%s%s", - fmt.Sprintf("%s:%d", x.Host, x.Port), + hostport, string(byte(x.Type)), url.QueryEscape(x.Selector), ),