Browse Source

Http download fixes

Author: jgg
Date: 1999-02-27 22:29:11 GMT
Http download fixes
debian/1.8.y
Arch Librarian 18 years ago
parent
commit
2b154e536a
  1. 6
      apt-pkg/acquire-item.cc
  2. 3
      apt-pkg/contrib/strutl.cc
  3. 4
      cmdline/acqprogress.cc
  4. 2
      debian/libapt-pkg-doc.postinst
  5. 2
      debian/libapt-pkg-doc.prerm
  6. 5
      doc/examples/apt.conf
  7. 24
      methods/http.cc
  8. 25
      test/scratch.cc

6
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;
}

3
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 /*{{{*/

4
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;
}

2
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

2
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)

5
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";

24
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;
}

25
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;
}

Loading…
Cancel
Save