]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/acquire-method.cc
make http size check work
[apt.git] / apt-pkg / acquire-method.cc
index 58d214068ec3d1d86cfb21c2e470a2d4715ad158..330854e752adc655b6fa6f111a45c71acbd74757 100644 (file)
@@ -118,6 +118,18 @@ void pkgAcqMethod::Fail(string Err,bool Transient)
 
    std::cout << "\n" << std::flush;
 }
+                                                                       /*}}}*/
+// AcqMethod::DropPrivsOrDie - Drop privileges or die          /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+void pkgAcqMethod::DropPrivsOrDie()
+{
+   if (!DropPrivs()) {
+      Fail(false);
+      exit(112);       /* call the european emergency number */
+   }
+}
+
                                                                        /*}}}*/
 // AcqMethod::URIStart - Indicate a download is starting               /*{{{*/
 // ---------------------------------------------------------------------
@@ -351,6 +363,17 @@ int pkgAcqMethod::Run(bool Single)
               Tmp->LastModified = 0;
            Tmp->IndexFile = StringToBool(LookupTag(Message,"Index-File"),false);
            Tmp->FailIgnore = StringToBool(LookupTag(Message,"Fail-Ignore"),false);
+           Tmp->ExpectedHashes = HashStringList();
+           for (char const * const * t = HashString::SupportedHashes(); *t != NULL; ++t)
+           {
+              std::string tag = "Expected-";
+              tag.append(*t);
+              std::string const hash = LookupTag(Message, tag.c_str());
+              if (hash.empty() == false)
+                 Tmp->ExpectedHashes.push_back(HashString(*t, hash));
+           }
+            char *End;
+            Tmp->ExpectedSize = strtoll(LookupTag(Message, "Expected-Size", "0").c_str(), &End, 10);
            Tmp->Next = 0;
            
            // Append it to the list