2010-01-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Replaced "." with A2STR::DOT_C
	* src/AbstractCommand.cc
	* src/Cookie.cc
	* src/DownloadContext.cc
	* src/FtpConnection.cc
	* src/RequestGroup.cc
	* src/util.cc
pull/1/head
Tatsuhiro Tsujikawa 2010-01-28 14:33:23 +00:00
parent eb4116ae57
commit 0bf9c31afc
7 changed files with 26 additions and 15 deletions

View File

@ -1,3 +1,13 @@
2010-01-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Replaced "." with A2STR::DOT_C
* src/AbstractCommand.cc
* src/Cookie.cc
* src/DownloadContext.cc
* src/FtpConnection.cc
* src/RequestGroup.cc
* src/util.cc
2010-01-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Replaced isNumberAndDotsNotation() with isNumericHost().

View File

@ -409,10 +409,10 @@ public:
bool operator()(const std::string& domain) const
{
if(util::startsWith(domain, ".")) {
if(util::startsWith(domain, A2STR::DOT_C)) {
return util::endsWith(_hostname, domain);
} else {
return util::endsWith(_hostname, "."+domain);
return util::endsWith(_hostname, A2STR::DOT_C+domain);
}
}
};
@ -427,7 +427,7 @@ static bool inNoProxy(const SharedHandle<Request>& req,
}
return
std::find_if(entries.begin(), entries.end(),
DomainMatch("."+req->getHost())) != entries.end();
DomainMatch(A2STR::DOT_C+req->getHost())) != entries.end();
}
bool AbstractCommand::isProxyDefined() const

View File

@ -51,7 +51,7 @@ static std::string prependDotIfNotExists(const std::string& domain)
// OPTIONAL. The value of the Domain attribute specifies the domain
// for which the cookie is valid. If an explicitly specified value
// does not start with a dot, the user agent supplies a leading dot.
return (!domain.empty() && domain[0] != '.') ? "."+domain : domain;
return (!domain.empty() && domain[0] != '.') ? A2STR::DOT_C+domain : domain;
}
std::string Cookie::normalizeDomain(const std::string& domain)
@ -61,7 +61,7 @@ std::string Cookie::normalizeDomain(const std::string& domain)
}
std::string md = prependDotIfNotExists(domain);
// TODO use util::split to strict verification
std::string::size_type p = md.find_last_of(".");
std::string::size_type p = md.find_last_of(A2STR::DOT_C);
if(p == 0 || p == std::string::npos) {
md += ".local";
}
@ -174,7 +174,8 @@ bool Cookie::validate(const std::string& requestHost,
return false;
}
// domain must include at least one embeded '.'
if(_domain.size() < 4 || _domain.find(".", 1) == std::string::npos) {
if(_domain.size() < 4 ||
_domain.find(A2STR::DOT_C, 1) == std::string::npos) {
return false;
}
if(!util::endsWith(normReqHost, _domain)) {
@ -217,7 +218,7 @@ std::string Cookie::toNsCookieFormat() const
{
std::stringstream ss;
ss << _domain << "\t";
if(util::startsWith(_domain, ".")) {
if(util::startsWith(_domain, A2STR::DOT_C)) {
ss << "TRUE";
} else {
ss << "FALSE";

View File

@ -42,7 +42,7 @@
namespace aria2 {
DownloadContext::DownloadContext():
_dir("."),
_dir(A2STR::DOT_C),
_pieceLength(0),
_knowsTotalLength(true),
_ownerRequestGroup(0),
@ -52,7 +52,7 @@ DownloadContext::DownloadContext():
DownloadContext::DownloadContext(size_t pieceLength,
uint64_t totalLength,
const std::string& path):
_dir("."),
_dir(A2STR::DOT_C),
_pieceLength(pieceLength),
_knowsTotalLength(true),
_ownerRequestGroup(0),

View File

@ -436,11 +436,11 @@ unsigned int FtpConnection::receivePasvResponse(std::pair<std::string, uint16_t>
&h1, &h2, &h3, &h4, &p1, &p2);
// ip address
dest.first = util::uitos(h1);
dest.first += ".";
dest.first += A2STR::DOT_C;
dest.first += util::uitos(h2);
dest.first += ".";
dest.first += A2STR::DOT_C;
dest.first += util::uitos(h3);
dest.first += ".";
dest.first += A2STR::DOT_C;
dest.first += util::uitos(h4);
// port number
dest.second = 256*p1+p2;

View File

@ -618,7 +618,7 @@ bool RequestGroup::tryAutoFileRenaming()
return false;
}
for(unsigned int i = 1; i < 10000; ++i) {
File newfile(strconcat(filepath, ".", util::uitos(i)));
File newfile(strconcat(filepath, A2STR::DOT_C, util::uitos(i)));
File ctrlfile(newfile.getPath()+DefaultBtProgressInfoFile::getSuffix());
if(!newfile.exists() || (newfile.exists() && ctrlfile.exists())) {
_downloadContext->getFirstFileEntry()->setPath(newfile.getPath());

View File

@ -635,7 +635,7 @@ std::string getContentDispositionFilename(const std::string& header) {
std::string fn =
File(trim(header.substr
(filenamesp, filenameep-filenamesp), TRIMMED)).getBasename();
if(fn == ".." || fn == ".") {
if(fn == ".." || fn == A2STR::DOT_C) {
return A2STR::NIL;
} else {
return fn;
@ -742,7 +742,7 @@ std::string abbrevSize(int64_t size)
size >>= 10;
}
std::string result = itos(size, true);
result += ".";
result += A2STR::DOT_C;
result += itos(r*10/1024);
result += units[i];
result += "i";