]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/acquire-worker.cc
* apt-pkg/contrib/mmap.{h,cc}:
[apt.git] / apt-pkg / acquire-worker.cc
index 460f599611dba48868c515b7535ad6584fe95365..4f0b52af9739e213d5ef55d578bcbf5250c8f74e 100644 (file)
@@ -220,6 +220,20 @@ bool pkgAcquire::Worker::RunMessages()
         Status = LookupTag(Message,"Message");
         break;
            
         Status = LookupTag(Message,"Message");
         break;
            
+         // 103 Redirect
+         case 103:
+         {
+            if (Itm == 0)
+            {
+               _error->Error("Method gave invalid 103 Redirect message");
+               break;
+            }
+            string NewURI = LookupTag(Message,"New-URI",URI.c_str());
+            Itm->URI = NewURI;
+            break;
+         }
+   
         // 200 URI Start
         case 200:
         {
         // 200 URI Start
         case 200:
         {
@@ -273,7 +287,9 @@ bool pkgAcquire::Worker::RunMessages()
            if(!expectedHash.empty()) 
            {
               string hashTag = expectedHash.HashType()+"-Hash";
            if(!expectedHash.empty()) 
            {
               string hashTag = expectedHash.HashType()+"-Hash";
-              RecivedHash = expectedHash.HashType() + ":" + LookupTag(Message, hashTag.c_str());
+              string hashSum = LookupTag(Message, hashTag.c_str());
+              if(!hashSum.empty())
+                 RecivedHash = expectedHash.HashType() + ":" + hashSum;
               if(_config->FindB("Debug::pkgAcquire::Auth", false) == true)
               {
                  clog << "201 URI Done: " << Owner->DescURI() << endl
               if(_config->FindB("Debug::pkgAcquire::Auth", false) == true)
               {
                  clog << "201 URI Done: " << Owner->DescURI() << endl
@@ -323,6 +339,7 @@ bool pkgAcquire::Worker::RunMessages()
            // set some status
            if(LookupTag(Message,"FailReason") == "Timeout" || 
               LookupTag(Message,"FailReason") == "TmpResolveFailure" ||
            // set some status
            if(LookupTag(Message,"FailReason") == "Timeout" || 
               LookupTag(Message,"FailReason") == "TmpResolveFailure" ||
+              LookupTag(Message,"FailReason") == "ResolveFailure" ||
               LookupTag(Message,"FailReason") == "ConnectionRefused") 
               Owner->Status = pkgAcquire::Item::StatTransientNetworkError;
 
               LookupTag(Message,"FailReason") == "ConnectionRefused") 
               Owner->Status = pkgAcquire::Item::StatTransientNetworkError;
 
@@ -510,10 +527,6 @@ bool pkgAcquire::Worker::OutFdReady()
    
    if (Res <= 0)
       return MethodFailure();
    
    if (Res <= 0)
       return MethodFailure();
-
-   // Hmm.. this should never happen.
-   if (Res < 0)
-      return true;
    
    OutQueue.erase(0,Res);
    if (OutQueue.empty() == true)
    
    OutQueue.erase(0,Res);
    if (OutQueue.empty() == true)
@@ -541,7 +554,8 @@ bool pkgAcquire::Worker::MethodFailure()
 {
    _error->Error("Method %s has died unexpectedly!",Access.c_str());
    
 {
    _error->Error("Method %s has died unexpectedly!",Access.c_str());
    
-   ExecWait(Process,Access.c_str(),true);
+   // do not reap the child here to show meaningfull error to the user
+   ExecWait(Process,Access.c_str(),false);
    Process = -1;
    close(InFd);
    close(OutFd);
    Process = -1;
    close(InFd);
    close(OutFd);