MCPcopy Create free account
hub / github.com/gokrazy/gokrazy / targetForRequest

Function targetForRequest

httpsredirect.go:8–19  ·  view source on GitHub ↗
(r *http.Request, redirectPort string)

Source from the content-addressed store, hash-verified

6)
7
8func targetForRequest(r *http.Request, redirectPort string) string {
9 host, _, err := net.SplitHostPort(r.Host)
10 if err != nil {
11 host = r.Host
12 }
13 r.URL.Host = host
14 if redirectPort != "443" {
15 r.URL.Host += ":" + redirectPort
16 }
17 r.URL.Scheme = "https"
18 return r.URL.String()
19}
20
21func httpsRedirect(redirectPort string) func(w http.ResponseWriter, r *http.Request) {
22 return func(w http.ResponseWriter, r *http.Request) {

Callers 2

TestHTTPSRedirectFunction · 0.85
httpsRedirectFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestHTTPSRedirectFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…