-
Notifications
You must be signed in to change notification settings - Fork 82
Allows different ports in host mismatch check #2681
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
Conversation
@@ -37,7 +37,7 @@ func MatchHost(host1, host2 string) bool { | |||
if err != nil { | |||
return false | |||
} | |||
return u1.Host == u2.Host | |||
return u1.Hostname() == u2.Hostname() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have any cases when port difference should be not allowed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general different port means different URL, so https://x.com should be equal to https://x.com:443 but not to any other port.
@@ -28,6 +28,7 @@ func TestNormalizeHost(t *testing.T) { | |||
func TestMatchHost(t *testing.T) { | |||
assert.True(t, MatchHost("https://foo.com", "https://foo.com")) | |||
assert.True(t, MatchHost("https://foo.com", "foo.com")) | |||
assert.True(t, MatchHost("https://foo.com", "https://foo.com:443")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test for
assert.False(t, MatchHost("https://foo.com", "https://foo.com:4430"))
assert.False(t, MatchHost("https://foo.com", "https://foo.com:80"))
@@ -37,7 +37,7 @@ func MatchHost(host1, host2 string) bool { | |||
if err != nil { | |||
return false | |||
} | |||
return u1.Host == u2.Host | |||
return u1.Hostname() == u2.Hostname() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general different port means different URL, so https://x.com should be equal to https://x.com:443 but not to any other port.
We can probably close this one as original feature for DATABRICKS_HOST mismatch check was reverted |
Closing as DATABRICKS_HOST mismatch check was reverted |
Changes
Allow different ports to be defined in profile/env and config host
Why
In Web Terminal
DATABRICKS_HOST
variable is set with explicit 443 portTests
Unit test