mirror of https://github.com/aria2/aria2
2010-03-07 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
urlencode -> percentEncode, torrentUrlencode -> torrentPercentEncode * src/BtHandshakeMessage.cc * src/BtHandshakeMessageValidator.h * src/DHTMessageFactoryImpl.cc * src/DefaultBtAnnounce.cc * src/HandshakeExtensionMessage.cc * src/HttpRequest.cc * src/XmlRpcMethodImpl.cc * src/bittorrent_helper.cc * src/util.cc * src/util.h * test/DHTAnnouncePeerMessageTest.cc * test/DHTGetPeersMessageTest.cc * test/DHTGetPeersReplyMessageTest.cc * test/UTPexExtensionMessageTest.cc * test/UtilTest.ccpull/1/head
parent
4785b7190c
commit
10b52bd9ac
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,23 @@
|
||||||
|
2010-03-07 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
urlencode -> percentEncode,
|
||||||
|
torrentUrlencode -> torrentPercentEncode
|
||||||
|
* src/BtHandshakeMessage.cc
|
||||||
|
* src/BtHandshakeMessageValidator.h
|
||||||
|
* src/DHTMessageFactoryImpl.cc
|
||||||
|
* src/DefaultBtAnnounce.cc
|
||||||
|
* src/HandshakeExtensionMessage.cc
|
||||||
|
* src/HttpRequest.cc
|
||||||
|
* src/XmlRpcMethodImpl.cc
|
||||||
|
* src/bittorrent_helper.cc
|
||||||
|
* src/util.cc
|
||||||
|
* src/util.h
|
||||||
|
* test/DHTAnnouncePeerMessageTest.cc
|
||||||
|
* test/DHTGetPeersMessageTest.cc
|
||||||
|
* test/DHTGetPeersReplyMessageTest.cc
|
||||||
|
* test/UTPexExtensionMessageTest.cc
|
||||||
|
* test/UtilTest.cc
|
||||||
|
|
||||||
2010-03-07 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2010-03-07 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Fixed the bug that filename is percent encoded where it must be
|
Fixed the bug that filename is percent encoded where it must be
|
||||||
|
|
|
@ -104,7 +104,7 @@ size_t BtHandshakeMessage::getMessageLength() {
|
||||||
|
|
||||||
std::string BtHandshakeMessage::toString() const {
|
std::string BtHandshakeMessage::toString() const {
|
||||||
return strconcat(NAME, " peerId=",
|
return strconcat(NAME, " peerId=",
|
||||||
util::urlencode(peerId, PEER_ID_LENGTH),
|
util::percentEncode(peerId, PEER_ID_LENGTH),
|
||||||
", reserved=",
|
", reserved=",
|
||||||
util::toHex(reserved, RESERVED_LENGTH));
|
util::toHex(reserved, RESERVED_LENGTH));
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,8 @@ public:
|
||||||
if(memcmp(BtHandshakeMessage::BT_PSTR, message->getPstr(), 19) != 0) {
|
if(memcmp(BtHandshakeMessage::BT_PSTR, message->getPstr(), 19) != 0) {
|
||||||
throw DL_ABORT_EX
|
throw DL_ABORT_EX
|
||||||
(StringFormat("invalid handshake pstr=%s",
|
(StringFormat("invalid handshake pstr=%s",
|
||||||
util::urlencode(message->getPstr(), 19).c_str()).str());
|
util::percentEncode
|
||||||
|
(message->getPstr(), 19).c_str()).str());
|
||||||
}
|
}
|
||||||
if(memcmp(infoHash, message->getInfoHash(), 20) != 0) {
|
if(memcmp(infoHash, message->getInfoHash(), 20) != 0) {
|
||||||
throw DL_ABORT_EX
|
throw DL_ABORT_EX
|
||||||
|
|
|
@ -232,9 +232,11 @@ DHTMessageFactoryImpl::createResponseMessage(const std::string& messageType,
|
||||||
// for now, just report error message arrived and throw exception.
|
// for now, just report error message arrived and throw exception.
|
||||||
const BDE& e = getList(dict, DHTUnknownMessage::E);
|
const BDE& e = getList(dict, DHTUnknownMessage::E);
|
||||||
if(e.size() == 2) {
|
if(e.size() == 2) {
|
||||||
_logger->info("Received Error DHT message. code=%s, msg=%s",
|
if(_logger->info()) {
|
||||||
util::itos(getInteger(e, 0).i()).c_str(),
|
_logger->info("Received Error DHT message. code=%s, msg=%s",
|
||||||
util::urlencode(getString(e, 1).s()).c_str());
|
util::itos(getInteger(e, 0).i()).c_str(),
|
||||||
|
util::percentEncode(getString(e, 1).s()).c_str());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if(_logger->debug()) {
|
if(_logger->debug()) {
|
||||||
_logger->debug("e doesn't have 2 elements.");
|
_logger->debug("e doesn't have 2 elements.");
|
||||||
|
@ -244,7 +246,7 @@ DHTMessageFactoryImpl::createResponseMessage(const std::string& messageType,
|
||||||
} else if(y.s() != DHTResponseMessage::R) {
|
} else if(y.s() != DHTResponseMessage::R) {
|
||||||
throw DL_ABORT_EX
|
throw DL_ABORT_EX
|
||||||
(StringFormat("Malformed DHT message. y != r: y=%s",
|
(StringFormat("Malformed DHT message. y != r: y=%s",
|
||||||
util::urlencode(y.s()).c_str()).str());
|
util::percentEncode(y.s()).c_str()).str());
|
||||||
}
|
}
|
||||||
const BDE& rDict = getDictionary(dict, DHTResponseMessage::R);
|
const BDE& rDict = getDictionary(dict, DHTResponseMessage::R);
|
||||||
const BDE& id = getString(rDict, DHTMessage::ID);
|
const BDE& id = getString(rDict, DHTMessage::ID);
|
||||||
|
|
|
@ -144,10 +144,11 @@ std::string DefaultBtAnnounce::getAnnounceUrl() {
|
||||||
std::string uri = announceList.getAnnounce();
|
std::string uri = announceList.getAnnounce();
|
||||||
uri += uriHasQuery(uri) ? "&" : "?";
|
uri += uriHasQuery(uri) ? "&" : "?";
|
||||||
uri += "info_hash=";
|
uri += "info_hash=";
|
||||||
uri += util::torrentUrlencode(bittorrent::getInfoHash(_downloadContext),
|
uri += util::torrentPercentEncode(bittorrent::getInfoHash(_downloadContext),
|
||||||
INFO_HASH_LENGTH);
|
INFO_HASH_LENGTH);
|
||||||
uri += "&peer_id=";
|
uri += "&peer_id=";
|
||||||
uri += util::torrentUrlencode(bittorrent::getStaticPeerId(), PEER_ID_LENGTH);
|
uri += util::torrentPercentEncode(bittorrent::getStaticPeerId(),
|
||||||
|
PEER_ID_LENGTH);
|
||||||
uri += "&uploaded=";
|
uri += "&uploaded=";
|
||||||
uri += util::uitos(stat.getSessionUploadLength());
|
uri += util::uitos(stat.getSessionUploadLength());
|
||||||
uri += "&downloaded=";
|
uri += "&downloaded=";
|
||||||
|
@ -158,7 +159,7 @@ std::string DefaultBtAnnounce::getAnnounceUrl() {
|
||||||
uri += "&key=";
|
uri += "&key=";
|
||||||
// Use last 8 bytes of peer ID as a key
|
// Use last 8 bytes of peer ID as a key
|
||||||
size_t keyLen = 8;
|
size_t keyLen = 8;
|
||||||
uri += util::torrentUrlencode
|
uri += util::torrentPercentEncode
|
||||||
(bittorrent::getStaticPeerId()+PEER_ID_LENGTH-keyLen, keyLen);
|
(bittorrent::getStaticPeerId()+PEER_ID_LENGTH-keyLen, keyLen);
|
||||||
uri += "&numwant=";
|
uri += "&numwant=";
|
||||||
uri += util::uitos(numWant);
|
uri += util::uitos(numWant);
|
||||||
|
@ -173,7 +174,7 @@ std::string DefaultBtAnnounce::getAnnounceUrl() {
|
||||||
uri += event;
|
uri += event;
|
||||||
}
|
}
|
||||||
if(!trackerId.empty()) {
|
if(!trackerId.empty()) {
|
||||||
uri += "&trackerid="+util::torrentUrlencode(trackerId);
|
uri += "&trackerid="+util::torrentPercentEncode(trackerId);
|
||||||
}
|
}
|
||||||
if(option->getAsBool(PREF_BT_REQUIRE_CRYPTO)) {
|
if(option->getAsBool(PREF_BT_REQUIRE_CRYPTO)) {
|
||||||
uri += "&requirecrypto=1";
|
uri += "&requirecrypto=1";
|
||||||
|
|
|
@ -83,7 +83,7 @@ std::string HandshakeExtensionMessage::toString() const
|
||||||
{
|
{
|
||||||
std::string s = getExtensionName();
|
std::string s = getExtensionName();
|
||||||
if(!_clientVersion.empty()) {
|
if(!_clientVersion.empty()) {
|
||||||
strappend(s, " client=", util::urlencode(_clientVersion));
|
strappend(s, " client=", util::percentEncode(_clientVersion));
|
||||||
}
|
}
|
||||||
if(_tcpPort > 0) {
|
if(_tcpPort > 0) {
|
||||||
strappend(s, ", tcpPort=", util::uitos(_tcpPort));
|
strappend(s, ", tcpPort=", util::uitos(_tcpPort));
|
||||||
|
@ -166,7 +166,7 @@ HandshakeExtensionMessage::create(const unsigned char* data, size_t length)
|
||||||
if(LogFactory::getInstance()->debug()) {
|
if(LogFactory::getInstance()->debug()) {
|
||||||
LogFactory::getInstance()->debug
|
LogFactory::getInstance()->debug
|
||||||
("Creating HandshakeExtensionMessage from %s",
|
("Creating HandshakeExtensionMessage from %s",
|
||||||
util::urlencode(data, length).c_str());
|
util::percentEncode(data, length).c_str());
|
||||||
}
|
}
|
||||||
const BDE dict = bencode::decode(data+1, length-1);
|
const BDE dict = bencode::decode(data+1, length-1);
|
||||||
if(!dict.isDict()) {
|
if(!dict.isDict()) {
|
||||||
|
|
|
@ -140,7 +140,7 @@ std::string HttpRequest::createRequest()
|
||||||
// Insert user into URI, like ftp://USER@host/
|
// Insert user into URI, like ftp://USER@host/
|
||||||
std::string uri = getCurrentURI();
|
std::string uri = getCurrentURI();
|
||||||
assert(uri.size() >= 6);
|
assert(uri.size() >= 6);
|
||||||
uri.insert(6, util::urlencode(_authConfig->getUser())+"@");
|
uri.insert(6, util::percentEncode(_authConfig->getUser())+"@");
|
||||||
requestLine += uri;
|
requestLine += uri;
|
||||||
} else {
|
} else {
|
||||||
requestLine += getCurrentURI();
|
requestLine += getCurrentURI();
|
||||||
|
|
|
@ -474,8 +474,8 @@ static void gatherPeer(BDE& peers, const SharedHandle<PeerStorage>& ps)
|
||||||
for(std::vector<SharedHandle<Peer> >::const_iterator i =
|
for(std::vector<SharedHandle<Peer> >::const_iterator i =
|
||||||
activePeers.begin(), eoi = activePeers.end(); i != eoi; ++i) {
|
activePeers.begin(), eoi = activePeers.end(); i != eoi; ++i) {
|
||||||
BDE peerEntry = BDE::dict();
|
BDE peerEntry = BDE::dict();
|
||||||
peerEntry[KEY_PEER_ID] = util::torrentUrlencode((*i)->getPeerId(),
|
peerEntry[KEY_PEER_ID] = util::torrentPercentEncode((*i)->getPeerId(),
|
||||||
PEER_ID_LENGTH);
|
PEER_ID_LENGTH);
|
||||||
peerEntry[KEY_IP] = (*i)->ipaddr;
|
peerEntry[KEY_IP] = (*i)->ipaddr;
|
||||||
peerEntry[KEY_PORT] = util::uitos((*i)->port);
|
peerEntry[KEY_PORT] = util::uitos((*i)->port);
|
||||||
peerEntry[KEY_BITFIELD] = util::toHex((*i)->getBitfield(),
|
peerEntry[KEY_BITFIELD] = util::toHex((*i)->getBitfield(),
|
||||||
|
|
|
@ -940,7 +940,7 @@ std::string torrent2Magnet(const BDE& attrs)
|
||||||
}
|
}
|
||||||
if(attrs.containsKey(NAME)) {
|
if(attrs.containsKey(NAME)) {
|
||||||
uri += "&dn=";
|
uri += "&dn=";
|
||||||
uri += util::urlencode(attrs[NAME].s());
|
uri += util::percentEncode(attrs[NAME].s());
|
||||||
}
|
}
|
||||||
if(attrs.containsKey(ANNOUNCE_LIST)) {
|
if(attrs.containsKey(ANNOUNCE_LIST)) {
|
||||||
const BDE& tiers = attrs[ANNOUNCE_LIST];
|
const BDE& tiers = attrs[ANNOUNCE_LIST];
|
||||||
|
@ -949,7 +949,7 @@ std::string torrent2Magnet(const BDE& attrs)
|
||||||
for(BDE::List::const_iterator uriiter = (*tieriter).listBegin(),
|
for(BDE::List::const_iterator uriiter = (*tieriter).listBegin(),
|
||||||
eoi2 = (*tieriter).listEnd(); uriiter != eoi2; ++uriiter) {
|
eoi2 = (*tieriter).listEnd(); uriiter != eoi2; ++uriiter) {
|
||||||
uri += "&tr=";
|
uri += "&tr=";
|
||||||
uri += util::urlencode((*uriiter).s());
|
uri += util::percentEncode((*uriiter).s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
12
src/util.cc
12
src/util.cc
|
@ -290,7 +290,7 @@ bool inRFC2616HttpToken(const char c)
|
||||||
&chars[arrayLength(chars)];
|
&chars[arrayLength(chars)];
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string urlencode(const unsigned char* target, size_t len) {
|
std::string percentEncode(const unsigned char* target, size_t len) {
|
||||||
std::string dest;
|
std::string dest;
|
||||||
for(size_t i = 0; i < len; ++i) {
|
for(size_t i = 0; i < len; ++i) {
|
||||||
if(!inRFC3986UnreservedChars(target[i])) {
|
if(!inRFC3986UnreservedChars(target[i])) {
|
||||||
|
@ -302,13 +302,13 @@ std::string urlencode(const unsigned char* target, size_t len) {
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string urlencode(const std::string& target)
|
std::string percentEncode(const std::string& target)
|
||||||
{
|
{
|
||||||
return urlencode(reinterpret_cast<const unsigned char*>(target.c_str()),
|
return percentEncode(reinterpret_cast<const unsigned char*>(target.c_str()),
|
||||||
target.size());
|
target.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string torrentUrlencode(const unsigned char* target, size_t len) {
|
std::string torrentPercentEncode(const unsigned char* target, size_t len) {
|
||||||
std::string dest;
|
std::string dest;
|
||||||
for(size_t i = 0; i < len; ++i) {
|
for(size_t i = 0; i < len; ++i) {
|
||||||
if(isAlpha(target[i]) || isDigit(target[i])) {
|
if(isAlpha(target[i]) || isDigit(target[i])) {
|
||||||
|
@ -320,9 +320,9 @@ std::string torrentUrlencode(const unsigned char* target, size_t len) {
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string torrentUrlencode(const std::string& target)
|
std::string torrentPercentEncode(const std::string& target)
|
||||||
{
|
{
|
||||||
return torrentUrlencode
|
return torrentPercentEncode
|
||||||
(reinterpret_cast<const unsigned char*>(target.c_str()), target.size());
|
(reinterpret_cast<const unsigned char*>(target.c_str()), target.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -137,9 +137,9 @@ bool endsWith(const std::string& target, const std::string& part);
|
||||||
|
|
||||||
std::string replace(const std::string& target, const std::string& oldstr, const std::string& newstr);
|
std::string replace(const std::string& target, const std::string& oldstr, const std::string& newstr);
|
||||||
|
|
||||||
std::string urlencode(const unsigned char* target, size_t len);
|
std::string percentEncode(const unsigned char* target, size_t len);
|
||||||
|
|
||||||
std::string urlencode(const std::string& target);
|
std::string percentEncode(const std::string& target);
|
||||||
|
|
||||||
bool inRFC3986ReservedChars(const char c);
|
bool inRFC3986ReservedChars(const char c);
|
||||||
|
|
||||||
|
@ -147,9 +147,9 @@ bool inRFC3986UnreservedChars(const char c);
|
||||||
|
|
||||||
std::string urldecode(const std::string& target);
|
std::string urldecode(const std::string& target);
|
||||||
|
|
||||||
std::string torrentUrlencode(const unsigned char* target, size_t len);
|
std::string torrentPercentEncode(const unsigned char* target, size_t len);
|
||||||
|
|
||||||
std::string torrentUrlencode(const std::string& target);
|
std::string torrentPercentEncode(const std::string& target);
|
||||||
|
|
||||||
std::string toHex(const unsigned char* src, size_t len);
|
std::string toHex(const unsigned char* src, size_t len);
|
||||||
|
|
||||||
|
|
|
@ -70,8 +70,8 @@ void DHTAnnouncePeerMessageTest::testGetBencodedMessage()
|
||||||
aDict["token"] = token;
|
aDict["token"] = token;
|
||||||
dict["a"] = aDict;
|
dict["a"] = aDict;
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(util::urlencode(bencode::encode(dict)),
|
CPPUNIT_ASSERT_EQUAL(util::percentEncode(bencode::encode(dict)),
|
||||||
util::urlencode(msgbody));
|
util::percentEncode(msgbody));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DHTAnnouncePeerMessageTest::testDoReceivedAction()
|
void DHTAnnouncePeerMessageTest::testDoReceivedAction()
|
||||||
|
|
|
@ -89,8 +89,8 @@ void DHTGetPeersMessageTest::testGetBencodedMessage()
|
||||||
aDict["info_hash"] = BDE(infoHash, DHT_ID_LENGTH);
|
aDict["info_hash"] = BDE(infoHash, DHT_ID_LENGTH);
|
||||||
dict["a"] = aDict;
|
dict["a"] = aDict;
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(util::urlencode(bencode::encode(dict)),
|
CPPUNIT_ASSERT_EQUAL(util::percentEncode(bencode::encode(dict)),
|
||||||
util::urlencode(msgbody));
|
util::percentEncode(msgbody));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DHTGetPeersMessageTest::testDoReceivedAction()
|
void DHTGetPeersMessageTest::testDoReceivedAction()
|
||||||
|
|
|
@ -70,8 +70,8 @@ void DHTGetPeersReplyMessageTest::testGetBencodedMessage()
|
||||||
|
|
||||||
rDict["nodes"] = compactNodeInfo;
|
rDict["nodes"] = compactNodeInfo;
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(util::urlencode(bencode::encode(dict)),
|
CPPUNIT_ASSERT_EQUAL(util::percentEncode(bencode::encode(dict)),
|
||||||
util::urlencode(msgbody));
|
util::percentEncode(msgbody));
|
||||||
}
|
}
|
||||||
rDict.removeKey("nodes");
|
rDict.removeKey("nodes");
|
||||||
{
|
{
|
||||||
|
@ -90,8 +90,8 @@ void DHTGetPeersReplyMessageTest::testGetBencodedMessage()
|
||||||
msg.setValues(peers);
|
msg.setValues(peers);
|
||||||
std::string msgbody = msg.getBencodedMessage();
|
std::string msgbody = msg.getBencodedMessage();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(util::urlencode(bencode::encode(dict)),
|
CPPUNIT_ASSERT_EQUAL(util::percentEncode(bencode::encode(dict)),
|
||||||
util::urlencode(msgbody));
|
util::percentEncode(msgbody));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,8 +96,8 @@ void UTPexExtensionMessageTest::testGetBencodedData()
|
||||||
std::string(&c3[0], &c3[6])+std::string(&c4[0], &c4[6])+
|
std::string(&c3[0], &c3[6])+std::string(&c4[0], &c4[6])+
|
||||||
"e";
|
"e";
|
||||||
std::string bd = msg.getPayload();
|
std::string bd = msg.getPayload();
|
||||||
CPPUNIT_ASSERT_EQUAL(util::urlencode(expected),
|
CPPUNIT_ASSERT_EQUAL(util::percentEncode(expected),
|
||||||
util::urlencode(bd));
|
util::percentEncode(bd));
|
||||||
}
|
}
|
||||||
|
|
||||||
void UTPexExtensionMessageTest::testToString()
|
void UTPexExtensionMessageTest::testToString()
|
||||||
|
|
|
@ -50,7 +50,7 @@ class UtilTest:public CppUnit::TestFixture {
|
||||||
CPPUNIT_TEST(testItos);
|
CPPUNIT_TEST(testItos);
|
||||||
CPPUNIT_TEST(testUitos);
|
CPPUNIT_TEST(testUitos);
|
||||||
CPPUNIT_TEST(testNtoh64);
|
CPPUNIT_TEST(testNtoh64);
|
||||||
CPPUNIT_TEST(testUrlencode);
|
CPPUNIT_TEST(testPercentEncode);
|
||||||
CPPUNIT_TEST(testHtmlEscape);
|
CPPUNIT_TEST(testHtmlEscape);
|
||||||
CPPUNIT_TEST(testJoinPath);
|
CPPUNIT_TEST(testJoinPath);
|
||||||
CPPUNIT_TEST(testParseIndexPath);
|
CPPUNIT_TEST(testParseIndexPath);
|
||||||
|
@ -101,7 +101,7 @@ public:
|
||||||
void testItos();
|
void testItos();
|
||||||
void testUitos();
|
void testUitos();
|
||||||
void testNtoh64();
|
void testNtoh64();
|
||||||
void testUrlencode();
|
void testPercentEncode();
|
||||||
void testHtmlEscape();
|
void testHtmlEscape();
|
||||||
void testJoinPath();
|
void testJoinPath();
|
||||||
void testParseIndexPath();
|
void testParseIndexPath();
|
||||||
|
@ -810,20 +810,20 @@ void UtilTest::testNtoh64()
|
||||||
#endif // !WORDS_BIGENDIAN
|
#endif // !WORDS_BIGENDIAN
|
||||||
}
|
}
|
||||||
|
|
||||||
void UtilTest::testUrlencode()
|
void UtilTest::testPercentEncode()
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT_EQUAL
|
CPPUNIT_ASSERT_EQUAL
|
||||||
(std::string("%3A%2F%3F%23%5B%5D%40%21%25%26%27%28%29%2A%2B%2C%3B%3D"),
|
(std::string("%3A%2F%3F%23%5B%5D%40%21%25%26%27%28%29%2A%2B%2C%3B%3D"),
|
||||||
util::urlencode(":/?#[]@!%&'()*+,;="));
|
util::percentEncode(":/?#[]@!%&'()*+,;="));
|
||||||
|
|
||||||
std::string unreserved =
|
std::string unreserved =
|
||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
"abcdefghijklmnopqrstuvwxyz"
|
"abcdefghijklmnopqrstuvwxyz"
|
||||||
"0123456789"
|
"0123456789"
|
||||||
"-._~";
|
"-._~";
|
||||||
CPPUNIT_ASSERT_EQUAL(unreserved, util::urlencode(unreserved));
|
CPPUNIT_ASSERT_EQUAL(unreserved, util::percentEncode(unreserved));
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("1%5EA%20"), util::urlencode("1^A "));
|
CPPUNIT_ASSERT_EQUAL(std::string("1%5EA%20"), util::percentEncode("1^A "));
|
||||||
}
|
}
|
||||||
|
|
||||||
void UtilTest::testHtmlEscape()
|
void UtilTest::testHtmlEscape()
|
||||||
|
|
Loading…
Reference in New Issue