mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Consolidate parseUrl arguments into a struct
This commit is contained in:
@@ -1390,7 +1390,7 @@ int fromCommandLine (
|
||||
|
||||
void fromNetwork (
|
||||
boost::asio::io_service& io_service,
|
||||
std::string const& strIp, const int iPort,
|
||||
std::string const& strIp, const std::uint16_t iPort,
|
||||
std::string const& strUsername, std::string const& strPassword,
|
||||
std::string const& strPath, std::string const& strMethod,
|
||||
Json::Value const& jvParams, const bool bSSL, const bool quiet,
|
||||
|
||||
@@ -47,19 +47,20 @@ public:
|
||||
, j_ (logs.journal ("RPCSub"))
|
||||
, logs_ (logs)
|
||||
{
|
||||
std::string strScheme;
|
||||
parsedURL pUrl;
|
||||
|
||||
if (!parseUrl (strUrl, strScheme, mIp, mPort, mPath))
|
||||
if (!parseUrl (pUrl, strUrl))
|
||||
Throw<std::runtime_error> ("Failed to parse url.");
|
||||
else if (strScheme == "https")
|
||||
else if (pUrl.scheme == "https")
|
||||
mSSL = true;
|
||||
else if (strScheme != "http")
|
||||
else if (pUrl.scheme != "http")
|
||||
Throw<std::runtime_error> ("Only http and https is supported.");
|
||||
|
||||
mSeq = 1;
|
||||
|
||||
if (mPort < 0)
|
||||
mPort = mSSL ? 443 : 80;
|
||||
mIp = pUrl.domain;
|
||||
mPort = (! pUrl.port) ? (mSSL ? 443 : 80) : *pUrl.port;
|
||||
mPath = pUrl.path;
|
||||
|
||||
JLOG (j_.info()) <<
|
||||
"RPCCall::fromNetwork sub: ip=" << mIp <<
|
||||
@@ -186,7 +187,7 @@ private:
|
||||
|
||||
std::string mUrl;
|
||||
std::string mIp;
|
||||
int mPort;
|
||||
std::uint16_t mPort;
|
||||
bool mSSL;
|
||||
std::string mUsername;
|
||||
std::string mPassword;
|
||||
|
||||
Reference in New Issue
Block a user