Summary: facebook::strings::URL has an authority() method. Having the same thing for folly::Uri help converting users of the URL class. This method just takes username, password, host, and port, and builds a string in the form <username>:<password>@<host>:<port>.
Test Plan: None.
Reviewed By: rajat@fb.com
FB internal diff:
D977450
fragment_ = submatch(match, 4);
}
+fbstring
+Uri::authority() const
+{
+ fbstring result(host());
+
+ if (port() != 0) {
+ result += fbstring(":") + to<fbstring>(port());
+ }
+
+ if (!username().empty()) {
+ fbstring userInformation(username());
+
+ if (!password().empty()) {
+ userInformation += fbstring(":") + password();
+ }
+
+ result = userInformation + "@" + result;
+ }
+
+ return result;
+}
+
} // namespace folly
const fbstring& query() const { return query_; }
const fbstring& fragment() const { return fragment_; }
+ fbstring authority() const;
+
template <class String>
String toString() const;