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> 2010-01-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Replaced isNumberAndDotsNotation() with isNumericHost(). Replaced isNumberAndDotsNotation() with isNumericHost().

View File

@ -409,10 +409,10 @@ public:
bool operator()(const std::string& domain) const bool operator()(const std::string& domain) const
{ {
if(util::startsWith(domain, ".")) { if(util::startsWith(domain, A2STR::DOT_C)) {
return util::endsWith(_hostname, domain); return util::endsWith(_hostname, domain);
} else { } 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 return
std::find_if(entries.begin(), entries.end(), std::find_if(entries.begin(), entries.end(),
DomainMatch("."+req->getHost())) != entries.end(); DomainMatch(A2STR::DOT_C+req->getHost())) != entries.end();
} }
bool AbstractCommand::isProxyDefined() const 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 // OPTIONAL. The value of the Domain attribute specifies the domain
// for which the cookie is valid. If an explicitly specified value // for which the cookie is valid. If an explicitly specified value
// does not start with a dot, the user agent supplies a leading dot. // 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) 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); std::string md = prependDotIfNotExists(domain);
// TODO use util::split to strict verification // 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) { if(p == 0 || p == std::string::npos) {
md += ".local"; md += ".local";
} }
@ -174,7 +174,8 @@ bool Cookie::validate(const std::string& requestHost,
return false; return false;
} }
// domain must include at least one embeded '.' // 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; return false;
} }
if(!util::endsWith(normReqHost, _domain)) { if(!util::endsWith(normReqHost, _domain)) {
@ -217,7 +218,7 @@ std::string Cookie::toNsCookieFormat() const
{ {
std::stringstream ss; std::stringstream ss;
ss << _domain << "\t"; ss << _domain << "\t";
if(util::startsWith(_domain, ".")) { if(util::startsWith(_domain, A2STR::DOT_C)) {
ss << "TRUE"; ss << "TRUE";
} else { } else {
ss << "FALSE"; ss << "FALSE";

View File

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

View File

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

View File

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

View File

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