summaryrefslogtreecommitdiff
path: root/src/mongo/client/mongo_uri.cpp
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2020-05-18 15:50:24 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-18 23:13:34 +0000
commit2fbd718e0ab222d4b6614c452b0241e325421395 (patch)
tree23debb249e289d6dc1368c2a44bd00fbc61e7fdd /src/mongo/client/mongo_uri.cpp
parentb3148d848547358244f055b25cbabe147f244a43 (diff)
downloadmongo-2fbd718e0ab222d4b6614c452b0241e325421395.tar.gz
SERVER-46189 Fix shell kill current ops with TLS replica set and down nodes
Diffstat (limited to 'src/mongo/client/mongo_uri.cpp')
-rw-r--r--src/mongo/client/mongo_uri.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/mongo/client/mongo_uri.cpp b/src/mongo/client/mongo_uri.cpp
index f0f8cab0978..d9153cb3c02 100644
--- a/src/mongo/client/mongo_uri.cpp
+++ b/src/mongo/client/mongo_uri.cpp
@@ -320,13 +320,11 @@ std::string MongoURI::redact(StringData url) {
return out.str();
}
-MongoURI MongoURI::parseImpl(const std::string& url) {
- const StringData urlSD(url);
-
+MongoURI MongoURI::parseImpl(StringData url) {
// 1. Validate and remove the scheme prefix `mongodb://` or `mongodb+srv://`
- const bool isSeedlist = urlSD.startsWith(kURISRVPrefix);
- if (!(urlSD.startsWith(kURIPrefix) || isSeedlist)) {
- return MongoURI(uassertStatusOK(ConnectionString::parse(url)));
+ const bool isSeedlist = url.startsWith(kURISRVPrefix);
+ if (!(url.startsWith(kURIPrefix) || isSeedlist)) {
+ return MongoURI(uassertStatusOK(ConnectionString::parse(url.toString())));
}
// 2. Split up the URI into its components for further parsing and validation
@@ -513,7 +511,7 @@ MongoURI MongoURI::parseImpl(const std::string& url) {
std::move(options));
}
-StatusWith<MongoURI> MongoURI::parse(const std::string& url) try {
+StatusWith<MongoURI> MongoURI::parse(StringData url) try {
return parseImpl(url);
} catch (const std::exception&) {
return exceptionToStatus();