mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-30 09:27:19 +02:00
config: fix policy matching for regular expressions (#2966)
* config: fix policy matching for regular expressions * compile regex in validate, add test * fix test
This commit is contained in:
parent
8e8c9c2f16
commit
ace5bbb89a
4 changed files with 66 additions and 8 deletions
|
@ -50,6 +50,16 @@ func ParseAndValidateURL(rawurl string) (*url.URL, error) {
|
|||
return u, nil
|
||||
}
|
||||
|
||||
// MustParseAndValidateURL parses the URL via ParseAndValidateURL but panics if there is an error.
|
||||
// (useful for testing)
|
||||
func MustParseAndValidateURL(rawURL string) url.URL {
|
||||
u, err := ParseAndValidateURL(rawURL)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return *u
|
||||
}
|
||||
|
||||
// ValidateURL wraps standard library's default url.Parse because
|
||||
// it's much more lenient about what type of urls it accepts than pomerium.
|
||||
func ValidateURL(u *url.URL) error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue