diff options
author | Mike Crute <mike@crute.us> | 2020-11-10 02:36:04 +0000 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2020-11-10 02:36:04 +0000 |
commit | 150abd9e30c17aa45b50de9ff178ccf3443b0b20 (patch) | |
tree | 20c5a244722184283173a3822f380c0db675ee6e /util/http.go | |
parent | 52eb9dc9fc1e0472aea4fd5bd0bb7ea259431d41 (diff) | |
download | go_ddns_manager-150abd9e30c17aa45b50de9ff178ccf3443b0b20.tar.bz2 go_ddns_manager-150abd9e30c17aa45b50de9ff178ccf3443b0b20.tar.xz go_ddns_manager-150abd9e30c17aa45b50de9ff178ccf3443b0b20.zip |
Extract web framework
Diffstat (limited to 'util/http.go')
-rw-r--r-- | util/http.go | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/util/http.go b/util/http.go deleted file mode 100644 index 31cd94d..0000000 --- a/util/http.go +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | package util | ||
2 | |||
3 | import ( | ||
4 | "fmt" | ||
5 | "net/http" | ||
6 | "net/url" | ||
7 | ) | ||
8 | |||
9 | func MakeURL(r *http.Request, path string, subs ...interface{}) *url.URL { | ||
10 | scheme := "https" | ||
11 | if r.TLS == nil { | ||
12 | scheme = "http" | ||
13 | } | ||
14 | |||
15 | // Always defer to whatever the proxy told us it was doing because this | ||
16 | // could be a mullet-VIP in either direction. | ||
17 | if fwProto := r.Header.Get("X-Forwarded-Proto"); fwProto != "" { | ||
18 | scheme = fwProto | ||
19 | } | ||
20 | |||
21 | return &url.URL{ | ||
22 | Scheme: scheme, | ||
23 | Host: r.Host, | ||
24 | Path: fmt.Sprintf(path, subs...), | ||
25 | } | ||
26 | } | ||