Add setPort() to folly::URI class.
authorWill Hodges <wch@fb.com>
Mon, 10 Mar 2014 17:15:35 +0000 (10:15 -0700)
committerDave Watson <davejwatson@fb.com>
Mon, 10 Mar 2014 20:51:14 +0000 (13:51 -0700)
Summary:
Add setPort() method to URI class for easy port replacement in
URIs.

Facebook:
Perform port replacement in WriteProcessor.cpp in a way that
supports URI schemes. Add setPort() method to URI class to replace
the port number in the authority portion of the URI.

Test Plan: Test in debugger for dfsrouter changes.

Reviewed By: tudorb@fb.com

FB internal diff: D1209120

folly/Uri.h

index bbee0bd3afd8538b53885cb34919e77ad1c0a4bc..29711197272656836f90121241dcbf6e83e1805b 100644 (file)
@@ -61,6 +61,8 @@ class Uri {
   std::string str() const { return toString<std::string>(); }
   fbstring fbstr() const { return toString<fbstring>(); }
 
+  void setPort(uint16_t port) {port_ = port;}
+
  private:
   fbstring scheme_;
   fbstring username_;