summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:52:57 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:52:57 +0000
commit2b154e536a0df3afb318ddcf9b7daf9337de3c23 (patch)
tree40d2dcee41e246a3d281d289cc5c2615f897a388
parenta9e5851b62cde2945fe3af44438b202c04c6703f (diff)
Http download fixes
Author: jgg Date: 1999-02-27 22:29:11 GMT Http download fixes
-rw-r--r--apt-pkg/acquire-item.cc6
-rw-r--r--apt-pkg/contrib/strutl.cc3
-rw-r--r--cmdline/acqprogress.cc4
-rwxr-xr-xdebian/libapt-pkg-doc.postinst2
-rwxr-xr-xdebian/libapt-pkg-doc.prerm2
-rw-r--r--doc/examples/apt.conf5
-rw-r--r--methods/http.cc24
-rw-r--r--test/scratch.cc25
8 files changed, 39 insertions, 32 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 37ce9bb2d..7e4ea5043 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -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;
}
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index b5086be04..eb3ef96a2 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -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 /*{{{*/
diff --git a/cmdline/acqprogress.cc b/cmdline/acqprogress.cc
index 2b4d295b4..190dc5e81 100644
--- a/cmdline/acqprogress.cc
+++ b/cmdline/acqprogress.cc
@@ -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;
}
diff --git a/debian/libapt-pkg-doc.postinst b/debian/libapt-pkg-doc.postinst
index 250bd190c..fc588d244 100755
--- a/debian/libapt-pkg-doc.postinst
+++ b/debian/libapt-pkg-doc.postinst
@@ -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
diff --git a/debian/libapt-pkg-doc.prerm b/debian/libapt-pkg-doc.prerm
index 6893d2cda..80592733b 100755
--- a/debian/libapt-pkg-doc.prerm
+++ b/debian/libapt-pkg-doc.prerm
@@ -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)
diff --git a/doc/examples/apt.conf b/doc/examples/apt.conf
index 8cf5b0b17..16234d4b1 100644
--- a/doc/examples/apt.conf
+++ b/doc/examples/apt.conf
@@ -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";
diff --git a/methods/http.cc b/methods/http.cc
index b5d26d127..25035b58a 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -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;
}
diff --git a/test/scratch.cc b/test/scratch.cc
index de306e802..dc02e059a 100644
--- a/test/scratch.cc
+++ b/test/scratch.cc
@@ -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;
}