-
Notifications
You must be signed in to change notification settings - Fork 57
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
Fix parsing of ports inside the URI #156
base: main
Are you sure you want to change the base?
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.
LGTM - needs one more review and possibly a future test case so this doesn't happen again.
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.
Please also add a test
038f54f
to
6bbe61b
Compare
without this change, urls like 5.my.s3.cluster were misinterpreted and the '5' parsed as the port of the url. Bug: * the getline() function puts the entire input string into the destination string, if the delimiter was not found. This leads to the entire host string being fed to the stoi() function to parse the port. Fix: * applied suggestion by @balamurugana
this flag assignement was removed in: minio#111 I don't know if it was removed intentional, but without it the BaseUrl.https flag only reflects the state of how BaseUrl was constructed with.
6bbe61b
to
8cded87
Compare
@@ -162,6 +162,7 @@ BaseUrl::BaseUrl(std::string host, bool https, std::string region) | |||
return; | |||
} | |||
|
|||
this->https = url.https; |
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.
This is not correct. this->https
is set in the constructor definition already.
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.
I have seen that, but the Url class parses the schema to set the https flag in the url class that…
Correct me if I am wrong, but if I am constructing a u=BasicUrl("https://foo.bar", false)
Then u.https is false
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.
Firstly BaseUrl
accepts host
. If URL is used, it takes only host and port. Secondly passed argument should override values. The current behavior is correct and this change is not correct.
without this change, urls like 5.my.s3.cluster were misinterpreted and
the '5' parsed as the port of the url.
Bug:
Fix: