X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/a2d40703e4a5590a689ace4466f92e590434944d..124e6916b7b02984803ff8217e8163947aae2882:/apt-pkg/acquire-method.cc?ds=sidebyside diff --git a/apt-pkg/acquire-method.cc b/apt-pkg/acquire-method.cc index 330854e75..d0eb01bbc 100644 --- a/apt-pkg/acquire-method.cc +++ b/apt-pkg/acquire-method.cc @@ -102,7 +102,10 @@ void pkgAcqMethod::Fail(string Err,bool Transient) if (Queue != 0) { std::cout << "400 URI Failure\nURI: " << Queue->Uri << "\n" - << "Message: " << Err << " " << IP << "\n"; + << "Message: " << Err; + if (IP.empty() == false && _config->FindB("Acquire::Failure::ShowIP", true) == true) + std::cout << " " << IP; + std::cout << "\n"; Dequeue(); } else @@ -124,7 +127,7 @@ void pkgAcqMethod::Fail(string Err,bool Transient) /* */ void pkgAcqMethod::DropPrivsOrDie() { - if (!DropPrivs()) { + if (!DropPrivileges()) { Fail(false); exit(112); /* call the european emergency number */ } @@ -373,7 +376,10 @@ int pkgAcqMethod::Run(bool Single) Tmp->ExpectedHashes.push_back(HashString(*t, hash)); } char *End; - Tmp->ExpectedSize = strtoll(LookupTag(Message, "Expected-Size", "0").c_str(), &End, 10); + if (Tmp->ExpectedHashes.FileSize() > 0) + Tmp->MaximumSize = Tmp->ExpectedHashes.FileSize(); + else + Tmp->MaximumSize = strtoll(LookupTag(Message, "Maximum-Size", "0").c_str(), &End, 10); Tmp->Next = 0; // Append it to the list @@ -382,14 +388,14 @@ int pkgAcqMethod::Run(bool Single) *I = Tmp; if (QueueBack == 0) QueueBack = Tmp; - + // Notify that this item is to be fetched. - if (Fetch(Tmp) == false) + if (URIAcquire(Message, Tmp) == false) Fail(); - - break; - } - } + + break; + } + } } Exit(); @@ -397,8 +403,6 @@ int pkgAcqMethod::Run(bool Single) } /*}}}*/ // AcqMethod::PrintStatus - privately really send a log/status message /*{{{*/ -// --------------------------------------------------------------------- -/* */ void pkgAcqMethod::PrintStatus(char const * const header, const char* Format, va_list &args) const { @@ -453,7 +457,7 @@ void pkgAcqMethod::Redirect(const string &NewURI) // --------------------------------------------------------------------- /* */ pkgAcqMethod::FetchResult::FetchResult() : LastModified(0), - IMSHit(false), Size(0), ResumePoint(0) + IMSHit(false), Size(0), ResumePoint(0), d(NULL) { } /*}}}*/ @@ -474,3 +478,12 @@ void pkgAcqMethod::Dequeue() { /*{{{*/ delete Tmp; } /*}}}*/ +pkgAcqMethod::~pkgAcqMethod() {} + +pkgAcqMethod::FetchItem::FetchItem() : + Next(nullptr), DestFileFd(-1), LastModified(0), IndexFile(false), + FailIgnore(false), MaximumSize(0), d(nullptr) +{} +pkgAcqMethod::FetchItem::~FetchItem() {} + +pkgAcqMethod::FetchResult::~FetchResult() {}