MCPcopy Index your code
hub / github.com/cloudflare/cloudflared / ValidateUrl

Function ValidateUrl

validation/validation.go:72–78  ·  view source on GitHub ↗

ValidateUrl returns a validated version of `originUrl` with a scheme prepended (by default http://). Note: when originUrl contains a scheme, the path is removed: ValidateUrl("https://localhost:8080/api/") => "https://localhost:8080" but when it does not, the path is preserved: ValidateUrl("loca

(originUrl string)

Source from the content-addressed store, hash-verified

70//
71// This is arguably a bug, but changing it might break some cloudflared users.
72func ValidateUrl(originUrl string) (*url.URL, error) {
73 urlStr, err := validateUrlString(originUrl)
74 if err != nil {
75 return nil, err
76 }
77 return url.Parse(urlStr)
78}
79
80func validateUrlString(originUrl string) (string, error) {
81 if originUrl == "" {

Callers 3

StartForwarderFunction · 0.92
ValidateUrlFunction · 0.92
TestValidateUrlFunction · 0.70

Calls 1

validateUrlStringFunction · 0.85

Tested by 1

TestValidateUrlFunction · 0.56