mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-23 19:49:13 +02:00
change Policy.Matches to accept a URL pointer (#5360)
This commit is contained in:
parent
9cd5fe4e25
commit
177f789e63
5 changed files with 9 additions and 9 deletions
|
@ -54,12 +54,12 @@ func ParseAndValidateURL(rawurl string) (*url.URL, error) {
|
|||
|
||||
// MustParseAndValidateURL parses the URL via ParseAndValidateURL but panics if there is an error.
|
||||
// (useful for testing)
|
||||
func MustParseAndValidateURL(rawURL string) url.URL {
|
||||
func MustParseAndValidateURL(rawURL string) *url.URL {
|
||||
u, err := ParseAndValidateURL(rawURL)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return *u
|
||||
return u
|
||||
}
|
||||
|
||||
// ValidateURL wraps standard library's default url.Parse because
|
||||
|
@ -187,6 +187,6 @@ func GetExternalRequest(internalURL, externalURL *url.URL, r *http.Request) *htt
|
|||
}
|
||||
|
||||
// MatchesServerName returnes true if the url's host matches the given server name.
|
||||
func MatchesServerName(u url.URL, serverName string) bool {
|
||||
func MatchesServerName(u *url.URL, serverName string) bool {
|
||||
return certmagic.MatchWildcard(u.Hostname(), serverName)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue