summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclsr <clsr@clsr.net>2017-08-22 11:58:26 +0200
committerclsr <clsr@clsr.net>2017-08-22 11:59:01 +0200
commitf3d19bf6d4f868644aea9004ed774efad9ce8706 (patch)
tree04b7317cddf34dc997ba934a3aa7c3c93a22555f
parent63b981cae2e7ee35c1c932f8dd24a603e53c1e13 (diff)
downloadcn-http-f3d19bf6d4f868644aea9004ed774efad9ce8706.tar.gz
cn-http-f3d19bf6d4f868644aea9004ed774efad9ce8706.zip
Fix external cnp:// URLs in gateway modev0.1.1
-rw-r--r--cn-http.service2
-rw-r--r--cnhttp.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/cn-http.service b/cn-http.service
index debeeb5..f7688bc 100644
--- a/cn-http.service
+++ b/cn-http.service
@@ -1,5 +1,5 @@
[Unit]
-Description=CNP-HTTP and CNM-HTML translating reverse proxy
+Description=CNP-HTTP and CNM-HTML translating gateway
After=network.target
[Service]
diff --git a/cnhttp.go b/cnhttp.go
index 42f723d..ab251af 100644
--- a/cnhttp.go
+++ b/cnhttp.go
@@ -573,7 +573,7 @@ func (srv *server) linkToURL(req *cnp.Request, link string) (urlStr, extern stri
host = req.Host()
}
if u, err := url.Parse(link); err == nil {
- if u.Scheme == "cnp" {
+ if u.Scheme == "cnp" && (srv.host == "" || u.Host == srv.host) {
var lhost, lpath string
lhost = u.Host
lpath = u.Path