kaysoky commented on a change in pull request #324: MESOS-9499 extended URI
syntax to support any Zookeeper authentication schemes
URL: https://github.com/apache/mesos/pull/324#discussion_r248384958
##########
File path: include/mesos/zookeeper/url.hpp
##########
@@ -101,16 +102,35 @@ inline Try<URL> URL::parse(const std::string& url)
// Look for the trailing '@' (if any), that's where servers starts.
size_t index = s.find_last_of('@');
- if (index != std::string::npos) {
- return URL(s.substr(0, index), s.substr(index + 1), path);
- } else {
+ if (index == std::string::npos)
return URL(s, path);
+
+ std::string servers = s.substr(index + 1);
+ std::string auth = s.substr(0, index);
+
+ size_t schemeDelimiter = auth.find_first_of('!');
+
+ // If there is not '!' in URL scheme is "digest" and everything before '@'
is credentials
+ std::string scheme = "digest";
+ std::string credentials = auth;
Review comment:
Ah, I missed that. However, if we use a `!` as a delimiter, that means the
user info cannot have exclamation marks. So something like:
```
zk://user:pass!word@host:port/path
```
Would give us a "authentication scheme" of `user:pass`, which would be
incorrect.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services