mirror of https://github.com/aria2/aria2
Removed strappend
parent
2e5d9b056f
commit
0da2468d6b
|
@ -82,20 +82,15 @@ std::string HandshakeExtensionMessage::getPayload()
|
||||||
|
|
||||||
std::string HandshakeExtensionMessage::toString() const
|
std::string HandshakeExtensionMessage::toString() const
|
||||||
{
|
{
|
||||||
std::string s = getExtensionName();
|
std::string s(fmt("%s client=%s, tcpPort=%u, metadataSize=%lu",
|
||||||
if(!clientVersion_.empty()) {
|
getExtensionName().c_str(),
|
||||||
strappend(s, " client=", util::percentEncode(clientVersion_));
|
util::percentEncode(clientVersion_).c_str(),
|
||||||
}
|
tcpPort_,
|
||||||
if(tcpPort_ > 0) {
|
metadataSize_));
|
||||||
strappend(s, ", tcpPort=", util::uitos(tcpPort_));
|
|
||||||
}
|
|
||||||
if(metadataSize_) {
|
|
||||||
strappend(s, ", metadataSize=", util::uitos(metadataSize_));
|
|
||||||
}
|
|
||||||
for(std::map<std::string, uint8_t>::const_iterator itr = extensions_.begin(),
|
for(std::map<std::string, uint8_t>::const_iterator itr = extensions_.begin(),
|
||||||
eoi = extensions_.end(); itr != eoi; ++itr) {
|
eoi = extensions_.end(); itr != eoi; ++itr) {
|
||||||
const std::map<std::string, uint8_t>::value_type& vt = *itr;
|
const std::map<std::string, uint8_t>::value_type& vt = *itr;
|
||||||
strappend(s, ", ", vt.first, "=", util::uitos(vt.second));
|
s += fmt(", %s=%u", vt.first.c_str(), vt.second);
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,8 @@ std::string HttpConnection::eraseConfidentialInfo(const std::string& request)
|
||||||
vend(A2_PROXY_AUTH_HEADER)-1)) {
|
vend(A2_PROXY_AUTH_HEADER)-1)) {
|
||||||
result += "Proxy-Authorization: Basic ********\n";
|
result += "Proxy-Authorization: Basic ********\n";
|
||||||
} else {
|
} else {
|
||||||
strappend(result, line, "\n");
|
result += line;
|
||||||
|
result += "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -131,7 +131,7 @@ std::string getHostText(const std::string& host, uint16_t port)
|
||||||
{
|
{
|
||||||
std::string hosttext = host;
|
std::string hosttext = host;
|
||||||
if(!(port == 80 || port == 443)) {
|
if(!(port == 80 || port == 443)) {
|
||||||
strappend(hosttext, ":", util::uitos(port));
|
hosttext += fmt(":%u", port);;
|
||||||
}
|
}
|
||||||
return hosttext;
|
return hosttext;
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,8 @@ std::string HttpRequest::createRequest()
|
||||||
std::string acceptTypes = "*/*";
|
std::string acceptTypes = "*/*";
|
||||||
for(std::vector<std::string>::const_iterator i = acceptTypes_.begin(),
|
for(std::vector<std::string>::const_iterator i = acceptTypes_.begin(),
|
||||||
eoi = acceptTypes_.end(); i != eoi; ++i) {
|
eoi = acceptTypes_.end(); i != eoi; ++i) {
|
||||||
strappend(acceptTypes, ",", (*i));
|
acceptTypes += ",";
|
||||||
|
acceptTypes += *i;
|
||||||
}
|
}
|
||||||
builtinHds.push_back(std::make_pair("Accept:", acceptTypes));
|
builtinHds.push_back(std::make_pair("Accept:", acceptTypes));
|
||||||
if(contentEncodingEnabled_) {
|
if(contentEncodingEnabled_) {
|
||||||
|
@ -242,7 +243,8 @@ std::string HttpRequest::createRequest()
|
||||||
getProtocol() == Request::PROTO_HTTPS);
|
getProtocol() == Request::PROTO_HTTPS);
|
||||||
for(std::vector<Cookie>::const_iterator itr = cookies.begin(),
|
for(std::vector<Cookie>::const_iterator itr = cookies.begin(),
|
||||||
eoi = cookies.end(); itr != eoi; ++itr) {
|
eoi = cookies.end(); itr != eoi; ++itr) {
|
||||||
strappend(cookiesValue, (*itr).toString(), ";");
|
cookiesValue += (*itr).toString();
|
||||||
|
cookiesValue += ";";
|
||||||
}
|
}
|
||||||
if(!cookiesValue.empty()) {
|
if(!cookiesValue.empty()) {
|
||||||
builtinHds.push_back(std::make_pair("Cookie:", cookiesValue));
|
builtinHds.push_back(std::make_pair("Cookie:", cookiesValue));
|
||||||
|
@ -263,28 +265,34 @@ std::string HttpRequest::createRequest()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(j == jend) {
|
if(j == jend) {
|
||||||
strappend(requestLine, (*i).first, " ", (*i).second, A2STR::CRLF);
|
requestLine += (*i).first;
|
||||||
|
requestLine += " ";
|
||||||
|
requestLine += (*i).second;
|
||||||
|
requestLine += "\r\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// append additional headers given by user.
|
// append additional headers given by user.
|
||||||
for(std::vector<std::string>::const_iterator i = headers_.begin(),
|
for(std::vector<std::string>::const_iterator i = headers_.begin(),
|
||||||
eoi = headers_.end(); i != eoi; ++i) {
|
eoi = headers_.end(); i != eoi; ++i) {
|
||||||
strappend(requestLine, (*i), A2STR::CRLF);
|
requestLine += *i;
|
||||||
|
requestLine += "\r\n";
|
||||||
}
|
}
|
||||||
requestLine += A2STR::CRLF;
|
requestLine += "\r\n";
|
||||||
return requestLine;
|
return requestLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string HttpRequest::createProxyRequest() const
|
std::string HttpRequest::createProxyRequest() const
|
||||||
{
|
{
|
||||||
assert(proxyRequest_);
|
assert(proxyRequest_);
|
||||||
std::string hostport = getURIHost();
|
//std::string hostport(fmt("%s:%u", getURIHost().c_str(), getPort()));
|
||||||
strappend(hostport, ":", util::uitos(getPort()));
|
std::string requestLine(fmt("CONNECT %s:%u HTTP/1.1\r\n"
|
||||||
|
"User-Agent: %s\r\n"
|
||||||
std::string requestLine = "CONNECT ";
|
"Host: %s:%u\r\n",
|
||||||
strappend(requestLine, hostport, " HTTP/1.1\r\n");
|
getURIHost().c_str(),
|
||||||
strappend(requestLine, "User-Agent: ", userAgent_, "\r\n");
|
getPort(),
|
||||||
strappend(requestLine, "Host: ", hostport, "\r\n");
|
userAgent_.c_str(),
|
||||||
|
getURIHost().c_str(),
|
||||||
|
getPort()));
|
||||||
// TODO Is "Proxy-Connection" needed here?
|
// TODO Is "Proxy-Connection" needed here?
|
||||||
// if(request->isKeepAliveEnabled() || request->isPipeliningEnabled()) {
|
// if(request->isKeepAliveEnabled() || request->isPipeliningEnabled()) {
|
||||||
// requestLine += "Proxy-Connection: Keep-Alive\r\n";
|
// requestLine += "Proxy-Connection: Keep-Alive\r\n";
|
||||||
|
@ -293,9 +301,12 @@ std::string HttpRequest::createProxyRequest() const
|
||||||
// }
|
// }
|
||||||
if(!proxyRequest_->getUsername().empty()) {
|
if(!proxyRequest_->getUsername().empty()) {
|
||||||
std::pair<std::string, std::string> auth = getProxyAuthString();
|
std::pair<std::string, std::string> auth = getProxyAuthString();
|
||||||
strappend(requestLine, auth.first, " ", auth.second, A2STR::CRLF);
|
requestLine += auth.first;
|
||||||
|
requestLine += " ";
|
||||||
|
requestLine += auth.second;
|
||||||
|
requestLine += "\r\n";
|
||||||
}
|
}
|
||||||
requestLine += A2STR::CRLF;
|
requestLine += "\r\n";
|
||||||
return requestLine;
|
return requestLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,21 +173,26 @@ void HttpServer::feedResponse(const std::string& status,
|
||||||
const std::string& contentType)
|
const std::string& contentType)
|
||||||
{
|
{
|
||||||
std::string httpDate = Time().toHTTPDate();
|
std::string httpDate = Time().toHTTPDate();
|
||||||
std::string header = "HTTP/1.1 ";
|
std::string header= fmt("HTTP/1.1 %s\r\n"
|
||||||
strappend(header, status, "\r\n",
|
"Date: %s\r\n"
|
||||||
"Date: ", httpDate, "\r\n",
|
"Content-Type: %s\r\n"
|
||||||
"Content-Type: ", contentType, "\r\n");
|
"Content-Length: %lu\r\n"
|
||||||
strappend(header, "Content-Length: ", util::uitos(text.size()), "\r\n",
|
"Expires: %s\r\n"
|
||||||
"Expires: ", httpDate, "\r\n",
|
"Cache-Control: no-cache\r\n"
|
||||||
"Cache-Control: no-cache\r\n");
|
"%s%s",
|
||||||
|
status.c_str(),
|
||||||
|
httpDate.c_str(),
|
||||||
|
contentType.c_str(),
|
||||||
|
static_cast<unsigned long>(text.size()),
|
||||||
|
httpDate.c_str(),
|
||||||
|
supportsGZip() ?
|
||||||
|
"Content-Encoding: gzip\r\n" : "",
|
||||||
|
!supportsPersistentConnection() ?
|
||||||
|
"Connection: close\r\n" : "");
|
||||||
if(!allowOrigin_.empty()) {
|
if(!allowOrigin_.empty()) {
|
||||||
strappend(header, "Access-Control-Allow-Origin: ", allowOrigin_, "\r\n");
|
header += "Access-Control-Allow-Origin: ";
|
||||||
}
|
header += allowOrigin_;
|
||||||
if(supportsGZip()) {
|
header += "\r\n";
|
||||||
header += "Content-Encoding: gzip\r\n";
|
|
||||||
}
|
|
||||||
if(!supportsPersistentConnection()) {
|
|
||||||
header += "Connection: close\r\n";
|
|
||||||
}
|
}
|
||||||
if(!headers.empty()) {
|
if(!headers.empty()) {
|
||||||
header += headers;
|
header += headers;
|
||||||
|
|
|
@ -107,13 +107,15 @@ std::string createLpdRequest
|
||||||
(const std::string& multicastAddress, uint16_t multicastPort,
|
(const std::string& multicastAddress, uint16_t multicastPort,
|
||||||
const std::string& infoHash, uint16_t port)
|
const std::string& infoHash, uint16_t port)
|
||||||
{
|
{
|
||||||
std::string req = "BT-SEARCH * HTTP/1.1\r\n";
|
return fmt("BT-SEARCH * HTTP/1.1\r\n"
|
||||||
strappend(req, "Host: ", multicastAddress, A2STR::COLON_C,
|
"Host: %s:%u\r\n"
|
||||||
util::uitos(multicastPort), A2STR::CRLF);
|
"Port: %u\r\n"
|
||||||
strappend(req, "Port: ", util::uitos(port), A2STR::CRLF);
|
"Infohash: %s\r\n"
|
||||||
strappend(req, "Infohash: ", util::toHex(infoHash), A2STR::CRLF);
|
"\r\n\r\n",
|
||||||
req += "\r\n\r\n";
|
multicastAddress.c_str(),
|
||||||
return req;
|
multicastPort,
|
||||||
|
port,
|
||||||
|
util::toHex(infoHash).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace bittorrent
|
} // namespace bittorrent
|
||||||
|
|
|
@ -89,7 +89,8 @@ void BooleanOptionHandler::parseArg(Option& option, const std::string& optarg)
|
||||||
option.put(pref_, A2_V_FALSE);
|
option.put(pref_, A2_V_FALSE);
|
||||||
} else {
|
} else {
|
||||||
std::string msg = pref_->k;
|
std::string msg = pref_->k;
|
||||||
strappend(msg, " ", _("must be either 'true' or 'false'."));
|
msg += " ";
|
||||||
|
msg += _("must be either 'true' or 'false'.");
|
||||||
throw DL_ABORT_EX(msg);
|
throw DL_ABORT_EX(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,10 +124,10 @@ void IntegerRangeOptionHandler::parseArg
|
||||||
int v = sgl.next();
|
int v = sgl.next();
|
||||||
if(v < min_ || max_ < v) {
|
if(v < min_ || max_ < v) {
|
||||||
std::string msg = pref_->k;
|
std::string msg = pref_->k;
|
||||||
strappend(msg, " ", _("must be between %s and %s."));
|
msg += " ";
|
||||||
|
msg += _("must be between %s and %s.");
|
||||||
throw DL_ABORT_EX
|
throw DL_ABORT_EX
|
||||||
(fmt(msg.c_str(), util::itos(min_).c_str(),
|
(fmt(msg.c_str(), util::itos(min_).c_str(), util::itos(max_).c_str()));
|
||||||
util::itos(max_).c_str()));
|
|
||||||
}
|
}
|
||||||
option.put(pref_, optarg);
|
option.put(pref_, optarg);
|
||||||
}
|
}
|
||||||
|
@ -320,7 +321,8 @@ void CumulativeOptionHandler::parseArg
|
||||||
(Option& option, const std::string& optarg)
|
(Option& option, const std::string& optarg)
|
||||||
{
|
{
|
||||||
std::string value = option.get(pref_);
|
std::string value = option.get(pref_);
|
||||||
strappend(value, optarg, delim_);
|
value += optarg;
|
||||||
|
value += delim_;
|
||||||
option.put(pref_, value);
|
option.put(pref_, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,7 +346,8 @@ void IndexOutOptionHandler::parseArg(Option& option, const std::string& optarg)
|
||||||
// See optarg is in the fomrat of "INDEX=PATH"
|
// See optarg is in the fomrat of "INDEX=PATH"
|
||||||
util::parseIndexPath(optarg);
|
util::parseIndexPath(optarg);
|
||||||
std::string value = option.get(pref_);
|
std::string value = option.get(pref_);
|
||||||
strappend(value, optarg, "\n");
|
value += optarg;
|
||||||
|
value += "\n";
|
||||||
option.put(pref_, value);
|
option.put(pref_, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,14 +448,17 @@ void ParameterOptionHandler::parseArg(Option& option, const std::string& optarg)
|
||||||
std::find(validParamValues_.begin(), validParamValues_.end(), optarg);
|
std::find(validParamValues_.begin(), validParamValues_.end(), optarg);
|
||||||
if(itr == validParamValues_.end()) {
|
if(itr == validParamValues_.end()) {
|
||||||
std::string msg = pref_->k;
|
std::string msg = pref_->k;
|
||||||
strappend(msg, " ", _("must be one of the following:"));
|
msg += " ";
|
||||||
|
msg += _("must be one of the following:");
|
||||||
if(validParamValues_.size() == 0) {
|
if(validParamValues_.size() == 0) {
|
||||||
msg += "''";
|
msg += "''";
|
||||||
} else {
|
} else {
|
||||||
for(std::vector<std::string>::const_iterator itr =
|
for(std::vector<std::string>::const_iterator itr =
|
||||||
validParamValues_.begin(), eoi = validParamValues_.end();
|
validParamValues_.begin(), eoi = validParamValues_.end();
|
||||||
itr != eoi; ++itr) {
|
itr != eoi; ++itr) {
|
||||||
strappend(msg, "'", *itr, "' ");
|
msg += "'";
|
||||||
|
msg += *itr;
|
||||||
|
msg += "' ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw DL_ABORT_EX(msg);
|
throw DL_ABORT_EX(msg);
|
||||||
|
@ -540,7 +546,9 @@ void HttpProxyUserOptionHandler::parseArg
|
||||||
if(uri.size() > 7) {
|
if(uri.size() > 7) {
|
||||||
uri += "@";
|
uri += "@";
|
||||||
}
|
}
|
||||||
strappend(uri, req.getHost(),A2STR::COLON_C,util::uitos(req.getPort()));
|
uri += req.getHost();
|
||||||
|
uri += ":";
|
||||||
|
uri += util::uitos(req.getPort());
|
||||||
option.put(proxyPref, uri);
|
option.put(proxyPref, uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -584,7 +592,9 @@ void HttpProxyPasswdOptionHandler::parseArg
|
||||||
if(uri.size() > 7) {
|
if(uri.size() > 7) {
|
||||||
uri += "@";
|
uri += "@";
|
||||||
}
|
}
|
||||||
strappend(uri, req.getHost(), A2STR::COLON_C,util::itos(req.getPort()));
|
uri += req.getHost();
|
||||||
|
uri += ":";
|
||||||
|
uri += util::itos(req.getPort());
|
||||||
option.put(proxyPref, uri);
|
option.put(proxyPref, uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@ namespace aria2 {
|
||||||
Peer::Peer(std::string ipaddr, uint16_t port, bool incoming):
|
Peer::Peer(std::string ipaddr, uint16_t port, bool incoming):
|
||||||
ipaddr_(ipaddr),
|
ipaddr_(ipaddr),
|
||||||
port_(port),
|
port_(port),
|
||||||
|
id_(fmt("%s(%u)", ipaddr_.c_str(), port_)),
|
||||||
firstContactTime_(global::wallclock()),
|
firstContactTime_(global::wallclock()),
|
||||||
badConditionStartTime_(0),
|
badConditionStartTime_(0),
|
||||||
seeder_(false),
|
seeder_(false),
|
||||||
|
@ -60,8 +61,6 @@ Peer::Peer(std::string ipaddr, uint16_t port, bool incoming):
|
||||||
{
|
{
|
||||||
memset(peerId_, 0, PEER_ID_LENGTH);
|
memset(peerId_, 0, PEER_ID_LENGTH);
|
||||||
resetStatus();
|
resetStatus();
|
||||||
id_ = ipaddr_;
|
|
||||||
strappend(id_, A2STR::COLON_C, util::uitos(port_));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Peer::~Peer()
|
Peer::~Peer()
|
||||||
|
|
|
@ -208,18 +208,16 @@ bool ServerStat::operator==(const ServerStat& serverStat) const
|
||||||
|
|
||||||
std::string ServerStat::toString() const
|
std::string ServerStat::toString() const
|
||||||
{
|
{
|
||||||
std::string res;
|
return fmt("host=%s, protocol=%s, dl_speed=%u, sc_avg_speed=%u,"
|
||||||
strappend(res, "host=", getHostname(), ", ");
|
" mc_avg_speed=%u, last_updated=%ld, counter=%u, status=%s",
|
||||||
strappend(res, "protocol=", getProtocol(), ", ");
|
getHostname().c_str(),
|
||||||
strappend(res, "dl_speed=", util::uitos(getDownloadSpeed()), ", ");
|
getProtocol().c_str(),
|
||||||
strappend(res, "sc_avg_speed=", util::uitos(getSingleConnectionAvgSpeed()),
|
getDownloadSpeed(),
|
||||||
", ");
|
getSingleConnectionAvgSpeed(),
|
||||||
strappend(res, "mc_avg_speed=", util::uitos(getMultiConnectionAvgSpeed()),
|
getMultiConnectionAvgSpeed(),
|
||||||
", ");
|
getLastUpdated().getTime(),
|
||||||
strappend(res, "last_updated=", util::itos(getLastUpdated().getTime()), ", ");
|
getCounter(),
|
||||||
strappend(res, "counter=", util::uitos(getCounter()), ", ");
|
ServerStat::STATUS_STRING[getStatus()].c_str());
|
||||||
strappend(res, "status=", ServerStat::STATUS_STRING[getStatus()]);
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace aria2
|
} // namespace aria2
|
||||||
|
|
|
@ -283,63 +283,6 @@ std::string strjoin(InputIterator first, InputIterator last,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T1, typename T2>
|
|
||||||
inline void strappend(std::string& base, const T1& a1, const T2& a2)
|
|
||||||
{
|
|
||||||
base += a1; base += a2;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T1, typename T2, typename T3>
|
|
||||||
inline void strappend(std::string& base,
|
|
||||||
const T1& a1, const T2& a2, const T3& a3)
|
|
||||||
{
|
|
||||||
base += a1; base += a2; base += a3;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T1, typename T2, typename T3, typename T4>
|
|
||||||
inline void strappend(std::string& base,
|
|
||||||
const T1& a1, const T2& a2, const T3& a3, const T4& a4)
|
|
||||||
{
|
|
||||||
base += a1; base += a2; base += a3; base += a4;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T1, typename T2, typename T3, typename T4, typename T5>
|
|
||||||
inline void strappend(std::string& base,
|
|
||||||
const T1& a1, const T2& a2, const T3& a3, const T4& a4,
|
|
||||||
const T5& a5)
|
|
||||||
{
|
|
||||||
base += a1; base += a2; base += a3; base += a4; base += a5;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T1, typename T2, typename T3, typename T4, typename T5,
|
|
||||||
typename T6>
|
|
||||||
inline void strappend(std::string& base,
|
|
||||||
const T1& a1, const T2& a2, const T3& a3, const T4& a4,
|
|
||||||
const T5& a5, const T6& a6)
|
|
||||||
{
|
|
||||||
base += a1; base += a2; base += a3; base += a4; base += a5; base += a6;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T1, typename T2, typename T3, typename T4, typename T5,
|
|
||||||
typename T6, typename T7>
|
|
||||||
inline void strappend(std::string& base,
|
|
||||||
const T1& a1, const T2& a2, const T3& a3, const T4& a4,
|
|
||||||
const T5& a5, const T6& a6, const T7& a7)
|
|
||||||
{
|
|
||||||
base += a1; base += a2; base += a3; base += a4; base += a5; base += a6;
|
|
||||||
base += a7;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T1, typename T2, typename T3, typename T4, typename T5,
|
|
||||||
typename T6, typename T7, typename T8>
|
|
||||||
inline void strappend(std::string& base,
|
|
||||||
const T1& a1, const T2& a2, const T3& a3, const T4& a4,
|
|
||||||
const T5& a5, const T6& a6, const T7& a7, const T8& a8)
|
|
||||||
{
|
|
||||||
base += a1; base += a2; base += a3; base += a4; base += a5; base += a6;
|
|
||||||
base += a7; base += a8;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class LeastRecentAccess:public std::binary_function<T, T, bool> {
|
class LeastRecentAccess:public std::binary_function<T, T, bool> {
|
||||||
public:
|
public:
|
||||||
|
|
12
src/util.cc
12
src/util.cc
|
@ -1588,8 +1588,16 @@ void executeHook
|
||||||
}
|
}
|
||||||
cmdline += "/C \"";
|
cmdline += "/C \"";
|
||||||
}
|
}
|
||||||
strappend(cmdline, "\"", command, "\"");
|
cmdline += "\"";
|
||||||
strappend(cmdline, " ", gidStr, " ", numFilesStr, " \"", firstFilename, "\"");
|
cmdline += command;
|
||||||
|
cmdline += "\"";
|
||||||
|
cmdline += " ";
|
||||||
|
cmdline += gidStr;
|
||||||
|
cmdline += " ";
|
||||||
|
cmdline += numFilesStr;
|
||||||
|
cmdline += " \"";
|
||||||
|
cmdline += firstFilename;
|
||||||
|
cmdline += "\"";
|
||||||
if(batch) {
|
if(batch) {
|
||||||
cmdline += "\"";
|
cmdline += "\"";
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ void PeerTest::testAmAllowedIndexSet() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerTest::testGetId() {
|
void PeerTest::testGetId() {
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("localhost:6969"), peer->getID());
|
CPPUNIT_ASSERT_EQUAL(std::string("localhost(6969)"), peer->getID());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerTest::testOperatorEqual()
|
void PeerTest::testOperatorEqual()
|
||||||
|
|
|
@ -14,14 +14,12 @@ class a2functionalTest:public CppUnit::TestFixture {
|
||||||
CPPUNIT_TEST(testMemFunSh);
|
CPPUNIT_TEST(testMemFunSh);
|
||||||
CPPUNIT_TEST(testAdopt2nd);
|
CPPUNIT_TEST(testAdopt2nd);
|
||||||
CPPUNIT_TEST(testStrjoin);
|
CPPUNIT_TEST(testStrjoin);
|
||||||
CPPUNIT_TEST(testStrappend);
|
|
||||||
CPPUNIT_TEST(testLeastRecentAccess);
|
CPPUNIT_TEST(testLeastRecentAccess);
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
public:
|
public:
|
||||||
void testMemFunSh();
|
void testMemFunSh();
|
||||||
void testAdopt2nd();
|
void testAdopt2nd();
|
||||||
void testStrjoin();
|
void testStrjoin();
|
||||||
void testStrappend();
|
|
||||||
void testLeastRecentAccess();
|
void testLeastRecentAccess();
|
||||||
|
|
||||||
class Greeting {
|
class Greeting {
|
||||||
|
@ -98,13 +96,6 @@ void a2functionalTest::testStrjoin()
|
||||||
strjoin(v.begin(), v.end(), " "));
|
strjoin(v.begin(), v.end(), " "));
|
||||||
}
|
}
|
||||||
|
|
||||||
void a2functionalTest::testStrappend()
|
|
||||||
{
|
|
||||||
std::string str = "X=";
|
|
||||||
strappend(str, "3", ",Y=", "5");
|
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("X=3,Y=5"), str);
|
|
||||||
}
|
|
||||||
|
|
||||||
void a2functionalTest::testLeastRecentAccess()
|
void a2functionalTest::testLeastRecentAccess()
|
||||||
{
|
{
|
||||||
std::vector<LastAccess> v;
|
std::vector<LastAccess> v;
|
||||||
|
|
Loading…
Reference in New Issue