-
Notifications
You must be signed in to change notification settings - Fork 647
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
api: Always strip 80/443 port from host #709
Conversation
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.
Must need. Thanks @vadmeste
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.
LGTM. Does it make sense to write a unit test for makeTargetURL
?
👍 |
Tests for makeTargetURL are added. |
api_unit_test.go
Outdated
{"localhost:9000", false, "mybucket", "myobject", "", nil, url.URL{Host: "localhost:9000", Scheme: "http", Path: "/mybucket/myobject"}, nil}, | ||
// Test 7 | ||
{"localhost:9000", false, "mybucket", "myobject", "", map[string][]string{"param": []string{"val"}}, url.URL{Host: "localhost:9000", Scheme: "http", Path: "/mybucket/myobject", RawQuery: "param=val"}, nil}, | ||
} |
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.
Could you add a test case each with address https://localhost:443
and http://localhost:80
?
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.
Could you add a test case each with address https://localhost:443 and http://localhost:80?
oups, yes
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.
Could you add a test case each with address https://localhost:443 and http://localhost:80?
Done @krisis
HTTP clients like browsers or curl automatically strip port 80 and 443 in Host header. This PR makes minio-go follow the same behavior so the generated presigned urls can work without having signature mismatch error.
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.
LGTM
HTTP clients like browsers or curl automatically strip port 80 and 443
in Host header. This PR makes minio-go follow the same behavior
so the generated presigned urls can work without having signature
mismatch error.
Fixes #695