mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-23 04:25:51 +00:00
Url Encode SMS messages.
This commit is contained in:
@@ -473,7 +473,7 @@ void HttpsClient::sendSMS(boost::asio::io_service& io_service, const std::string
|
|||||||
% theConfig.SMS_TO
|
% theConfig.SMS_TO
|
||||||
% theConfig.SMS_KEY
|
% theConfig.SMS_KEY
|
||||||
% theConfig.SMS_SECRET
|
% theConfig.SMS_SECRET
|
||||||
% strText);
|
% urlEncode(strText));
|
||||||
|
|
||||||
// cLog(lsINFO) << "SMS: Request:" << strURI;
|
// cLog(lsINFO) << "SMS: Request:" << strURI;
|
||||||
cLog(lsINFO) << "SMS: Request: '" << strText << "'";
|
cLog(lsINFO) << "SMS: Request: '" << strText << "'";
|
||||||
|
|||||||
@@ -187,6 +187,38 @@ std::string strCopy(const std::vector<unsigned char>& vucSrc)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern std::string urlEncode(const std::string& strSrc)
|
||||||
|
{
|
||||||
|
std::string strDst;
|
||||||
|
int iOutput = 0;
|
||||||
|
int iSize = strSrc.length();
|
||||||
|
|
||||||
|
strDst.resize(iSize*3);
|
||||||
|
|
||||||
|
for (int iInput = 0; iInput < iSize; iInput++) {
|
||||||
|
unsigned char c = strSrc[iInput];
|
||||||
|
|
||||||
|
if (c == ' ')
|
||||||
|
{
|
||||||
|
strDst[iOutput++] = '+';
|
||||||
|
}
|
||||||
|
else if (isalnum(c))
|
||||||
|
{
|
||||||
|
strDst[iOutput++] = c;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strDst[iOutput++] = '%';
|
||||||
|
strDst[iOutput++] = charHex(c >> 4);
|
||||||
|
strDst[iOutput++] = charHex(c & 15);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
strDst.resize(iOutput);
|
||||||
|
|
||||||
|
return strDst;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// DH support
|
// DH support
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -103,6 +103,8 @@ int iToSeconds(boost::posix_time::ptime ptWhen);
|
|||||||
boost::posix_time::ptime ptFromSeconds(int iSeconds);
|
boost::posix_time::ptime ptFromSeconds(int iSeconds);
|
||||||
uint64_t utFromSeconds(int iSeconds);
|
uint64_t utFromSeconds(int iSeconds);
|
||||||
|
|
||||||
|
extern std::string urlEncode(const std::string& strSrc);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void intIPtoStr(int ip,std::string& retStr);
|
void intIPtoStr(int ip,std::string& retStr);
|
||||||
int strIPtoInt(std::string& ipStr);
|
int strIPtoInt(std::string& ipStr);
|
||||||
|
|||||||
Reference in New Issue
Block a user