-
Notifications
You must be signed in to change notification settings - Fork 621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compare host using lowercase #543
Conversation
use lowercase comparison for host lookup #542
Moving conversation from #542 over here. Looking a bit deeper into the code it seems a bit inconsistent. When adding a route via a service tag the host is always forced lowercase as you have observed via Furthermore, incoming hosts are not always forced lower-case before searching the table. To be consistent we may want to modify the underlying |
@leprechau my Go skills are pretty basic and I had suggested this change as it worked for me. I am perfectly fine with any other changes as well. |
I think we can make all lookups and adds lowercase by making two simple changes in diff --git a/route/table.go b/route/table.go
index bb689dc..1646e74 100644
--- a/route/table.go
+++ b/route/table.go
@@ -136,6 +136,7 @@ func NewTable(s string) (t Table, err error) {
// addRoute adds a new route prefix -> target for the given service.
func (t Table) addRoute(d *RouteDef) error {
host, path := hostpath(d.Src)
+ host = strings.ToLower(host) // maintain compatibility with parseURLPrefixTag
if d.Src == "" {
return errInvalidPrefix
@@ -383,6 +384,7 @@ func (t Table) LookupHost(host string, pick picker) *Target {
}
func (t Table) lookup(host, path, trace string, pick picker, match matcher) *Target {
+ host = strings.ToLower(host) // routes are always added lowercase
for _, r := range t[host] {
if match(path, r) {
n := len(r.Targets) This wouldn't require any changes to the |
Running a |
@shantanugadgil Thank you! |
hehe @leprechau thank you !!! 👍 |
use lowercase comparison for host lookup #542