mirror of https://github.com/dexidp/dex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
373 B
21 lines
373 B
|
11 years ago
|
package net
|
||
|
|
|
||
|
|
import (
|
||
|
|
"net/url"
|
||
|
|
"strings"
|
||
|
|
)
|
||
|
|
|
||
|
|
// URLEqual checks two urls for equality using only the host and path portions.
|
||
|
|
func URLEqual(url1, url2 string) bool {
|
||
|
|
u1, err := url.Parse(url1)
|
||
|
|
if err != nil {
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
u2, err := url.Parse(url2)
|
||
|
|
if err != nil {
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
|
||
|
|
return strings.ToLower(u1.Host+u1.Path) == strings.ToLower(u2.Host+u2.Path)
|
||
|
|
}
|