]> git.saurik.com Git - apt.git/blobdiff - methods/connect.cc
tell the release script that we use git now
[apt.git] / methods / connect.cc
index ba2264faabfb017d05b6de5d8b4e932eeb68a673..fc7a72ee93a00ef9d3f9a9886d2ba9a7e083145c 100644 (file)
@@ -15,6 +15,9 @@
 
 #include <apt-pkg/error.h>
 #include <apt-pkg/fileutl.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/acquire-method.h>
+#include <apt-pkg/configuration.h>
 
 #include <stdio.h>
 #include <errno.h>
@@ -165,6 +168,13 @@ bool Connect(std::string Host,int Port,const char *Service,int DefPort,int &Fd,
       Hints.ai_flags = AI_ADDRCONFIG;
       Hints.ai_protocol = 0;
       
+      if(_config->FindB("Acquire::ForceIPv4", false) == true)
+         Hints.ai_family = AF_INET;
+      else if(_config->FindB("Acquire::ForceIPv6", false) == true)
+         Hints.ai_family = AF_INET6;
+      else
+         Hints.ai_family = AF_UNSPEC;
+
       // if we couldn't resolve the host before, we don't try now
       if(bad_addr.find(Host) != bad_addr.end()) 
         return _error->Error(_("Could not resolve '%s'"),Host.c_str());
@@ -195,6 +205,9 @@ bool Connect(std::string Host,int Port,const char *Service,int DefPort,int &Fd,
               return _error->Error(_("Temporary failure resolving '%s'"),
                                    Host.c_str());
            }
+           if (Res == EAI_SYSTEM)
+              return _error->Errno("getaddrinfo", _("System error resolving '%s:%s'"),
+                                      Host.c_str(),ServStr);
            return _error->Error(_("Something wicked happened resolving '%s:%s' (%i - %s)"),
                                 Host.c_str(),ServStr,Res,gai_strerror(Res));
         }