]> git.saurik.com Git - apt.git/commitdiff
Http download fixes
authorArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:52:57 +0000 (16:52 +0000)
committerArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:52:57 +0000 (16:52 +0000)
Author: jgg
Date: 1999-02-27 22:29:11 GMT
Http download fixes

apt-pkg/acquire-item.cc
apt-pkg/contrib/strutl.cc
cmdline/acqprogress.cc
debian/libapt-pkg-doc.postinst
debian/libapt-pkg-doc.prerm
doc/examples/apt.conf
methods/http.cc
test/scratch.cc

index 37ce9bb2d98146e6aceab14aef20313e180439e8..7e4ea5043a514fc63a66dd2758a868686aca38cd 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: acquire-item.cc,v 1.24 1999/02/19 07:56:06 jgg Exp $
+// $Id: acquire-item.cc,v 1.25 1999/02/27 22:29:11 jgg Exp $
 /* ######################################################################
 
    Acquire Item - Item to acquire
@@ -339,7 +339,9 @@ void pkgAcqIndexRel::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
    if (Cnf->LocalOnly == true || 
        StringToBool(LookupTag(Message,"Transient-Failure"),false) == false)
    {      
-      Status = StatIdle;
+      // Ignore this
+      Status = StatDone;
+      Complete = false;
       Dequeue();
       return;
    }
index b5086be04f5960276e74adb0d72e726c0ed83a86..eb3ef96a2992519399c90d03e50b8b32f1af0ec8 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: strutl.cc,v 1.19 1999/02/01 08:11:57 jgg Exp $
+// $Id: strutl.cc,v 1.20 1999/02/27 22:29:11 jgg Exp $
 /* ######################################################################
 
    String Util - Some usefull string functions.
@@ -25,6 +25,7 @@
 #include <ctype.h>
 #include <string.h>
 #include <stdio.h>
+#include <unistd.h>
                                                                        /*}}}*/
 
 // strstrip - Remove white space from the front and back of a string   /*{{{*/
index 2b4d295b482dbd7febead07af064830fdc27a89b..190dc5e8166b417421bd76371183d6ec1e504b6a 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: acqprogress.cc,v 1.9 1999/02/01 08:11:57 jgg Exp $
+// $Id: acqprogress.cc,v 1.10 1999/02/27 22:29:11 jgg Exp $
 /* ######################################################################
 
    Acquire Progress - Command line progress meter 
@@ -93,7 +93,7 @@ void AcqTextStatus::Fail(pkgAcquire::ItemDesc &Itm)
    if (Quiet <= 0)
       cout << '\r' << BlankLine << '\r';
    
-   if (Itm.Owner->Status == pkgAcquire::Item::StatIdle)
+   if (Itm.Owner->Status == pkgAcquire::Item::StatDone)
    {
       cout << "Ign " << Itm.Description << endl;
    }
index 250bd190c77a2b96e38bb3d0560a2767a5d7bf12..fc588d244095e9cd085c406a3f55f1ed04fa7d01 100755 (executable)
@@ -3,7 +3,7 @@
 case "$1" in
        configure)
               if [ -f /usr/sbin/dhelp_parse ]; then
-                #/usr/sbin/dhelp_parse -a /usr/doc/libapt-pkg-doc
+                /usr/sbin/dhelp_parse -a /usr/doc/libapt-pkg-doc
               fi
        ;;
 esac
index 6893d2cdab37fa25bf38672f0e4eef85bf02f443..80592733b1c84647ecbd3803419ce7bab438fd0a 100755 (executable)
@@ -3,7 +3,7 @@
 case "$1" in
        remove|upgrade|remove-in-favour|deconfigure-in-favour)
               if [ -f /usr/sbin/dhelp_parse ]; then
-                 #/usr/sbin/dhelp_parse -d /usr/doc/libapt-pkg-doc
+                 /usr/sbin/dhelp_parse -d /usr/doc/libapt-pkg-doc
               fi
               ;;
        failed-upgrade)
index 8cf5b0b17d41e20ab4ecbdbf4e16760b1787b4d2..16234d4b180eb3d7d008a9c9c974fa244ec26348 100644 (file)
@@ -1,4 +1,4 @@
-// $Id: apt.conf,v 1.24 1999/01/31 08:55:53 jgg Exp $
+// $Id: apt.conf,v 1.25 1999/02/27 22:29:11 jgg Exp $
 /* This file is an index of all APT configuration directives. It should
    NOT actually be used as a real config file, though it is a completely
    valid file.
@@ -52,13 +52,14 @@ APT {
 Acquire
 {
   Queue-Mode "host";       // host|access
-  Retry "false";
+  Retries "0";
   
   // HTTP method configuration
   http 
   {
     Proxy "http://127.0.0.1:3128";
     Proxy::http.us.debian.org "DIRECT";  // Specific per-host setting
+    Timeout "120";
     
     // Cache Control. Note these do not work with Squid 2.0.2
     No-Cache "false";
index b5d26d127754867fefbc5f5926127cb778b5990e..25035b58a877999a0e620b1d7bfe9651091e5fe8 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: http.cc,v 1.26 1999/02/15 00:26:55 jgg Exp $
+// $Id: http.cc,v 1.27 1999/02/27 22:29:11 jgg Exp $
 /* ######################################################################
 
    HTTP Aquire Method - This is the HTTP aquire method for APT.
@@ -795,6 +795,8 @@ bool HttpMethod::Flush(ServerState *Srv)
 /* */
 bool HttpMethod::ServerDie(ServerState *Srv)
 {
+   unsigned int LErrno = errno;
+   
    // Dump the buffer to the file
    if (Srv->State == ServerState::Data)
    {
@@ -815,8 +817,9 @@ bool HttpMethod::ServerDie(ServerState *Srv)
        Srv->Encoding != ServerState::Closes)
    {
       Srv->Close();
-      if (errno == 0)
+      if (LErrno == 0)
         return _error->Error("Error reading from server Remote end closed connection");
+      errno = LErrno;
       return _error->Errno("read","Error reading from server");
    }
    else
@@ -986,13 +989,7 @@ int HttpMethod::Loop()
    
    int FailCounter = 0;
    while (1)
-   {
-      if (FailCounter >= 2)
-      {
-        Fail("Massive Server Brain Damage",true);
-        FailCounter = 0;
-      }
-      
+   {      
       // We have no commands, wait for some to arrive
       if (Queue == 0)
       {
@@ -1051,6 +1048,13 @@ int HttpMethod::Loop()
            FailCounter++;
            _error->Discard();
            Server->Close();
+
+           if (FailCounter >= 2)
+           {
+              Fail("Connection timed out",true);
+              FailCounter = 0;
+           }
+           
            continue;
         }
       };
@@ -1087,7 +1091,7 @@ int HttpMethod::Loop()
               URIDone(Res);
            }
            else
-              Fail();
+              Fail(true);
 
            break;
         }
index de306e802f5926855ba97cedc90aa4b4f78217f1..dc02e059a3d275f7b9b50899c9c363ff4bf4e16a 100644 (file)
@@ -1,22 +1,21 @@
-#include <apt-pkg/acquire-item.h>
-#include <apt-pkg/acquire-worker.h>
-#include <apt-pkg/init.h>
-#include <apt-pkg/error.h>
-#include <strutl.h>
+#include <apt-pkg/tagfile.h>
 
 #include <signal.h>
 #include <stdio.h>
 
 int main(int argc,char *argv[])
 {
-
-   URI Foo(argv[1]);
-   cout << Foo.Access << '\'' << endl;
-   cout << Foo.Host << '\'' << endl;
-   cout << Foo.Path << '\'' << endl;
-   cout << Foo.User << '\'' << endl;
-   cout << Foo.Password << '\'' << endl;
-   cout << Foo.Port << endl;
+   FileFd F(argv[1],FileFd::ReadOnly);
+   pkgTagFile Reader(F);
+   
+   pkgTagSection Sect;
+   while (Reader.Step(Sect) == true)
+   {
+      Sect.FindS("Package");
+      Sect.FindS("Section");
+      Sect.FindS("Version");
+      Sect.FindI("Size");
+   };
    
    return 0;
 }