projects
/
apt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- fix "apt-get source pkg=ver" if binary name != source name
[apt.git]
/
methods
/
http.cc
diff --git
a/methods/http.cc
b/methods/http.cc
index 06b91686cb75d11cc8cf6beed274a48feb5744e2..b3c791fa0a0e2fd555e81b4361dd7076b08e88bf 100644
(file)
--- a/
methods/http.cc
+++ b/
methods/http.cc
@@
-3,7
+3,7
@@
// $Id: http.cc,v 1.59 2004/05/08 19:42:35 mdz Exp $
/* ######################################################################
// $Id: http.cc,v 1.59 2004/05/08 19:42:35 mdz Exp $
/* ######################################################################
- HTTP Aquire Method - This is the HTTP aquire method for APT.
+ HTTP A
c
quire Method - This is the HTTP aquire method for APT.
It uses HTTP/1.1 and many of the fancy options there-in, such as
pipelining, range, if-range and so on.
It uses HTTP/1.1 and many of the fancy options there-in, such as
pipelining, range, if-range and so on.
@@
-58,7
+58,7
@@
time_t HttpMethod::FailTime = 0;
unsigned long PipelineDepth = 10;
unsigned long TimeOut = 120;
bool Debug = false;
unsigned long PipelineDepth = 10;
unsigned long TimeOut = 120;
bool Debug = false;
-
+URI Proxy;
unsigned long CircleBuf::BwReadLimit=0;
unsigned long CircleBuf::BwTickReadData=0;
unsigned long CircleBuf::BwReadLimit=0;
unsigned long CircleBuf::BwTickReadData=0;
@@
-368,8
+368,8
@@
bool ServerState::Close()
/*}}}*/
// ServerState::RunHeaders - Get the headers before the data /*{{{*/
// ---------------------------------------------------------------------
/*}}}*/
// ServerState::RunHeaders - Get the headers before the data /*{{{*/
// ---------------------------------------------------------------------
-/* Returns 0 if things are OK, 1 if an IO error occur
s
ed and 2 if a header
- parse error occured */
+/* Returns 0 if things are OK, 1 if an IO error occur
r
ed and 2 if a header
+ parse error occur
r
ed */
int ServerState::RunHeaders()
{
State = Header;
int ServerState::RunHeaders()
{
State = Header;
@@
-941,7
+941,8
@@
int HttpMethod::DealWithHeaders(FetchResult &Res,ServerState *Srv)
if (Srv->StartPos >= 0)
{
Res.ResumePoint = Srv->StartPos;
if (Srv->StartPos >= 0)
{
Res.ResumePoint = Srv->StartPos;
- ftruncate(File->Fd(),Srv->StartPos);
+ if (ftruncate(File->Fd(),Srv->StartPos) < 0)
+ _error->Errno("ftruncate", _("Failed to truncate file"));
}
// Set the start point
}
// Set the start point
@@
-996,7
+997,6
@@
bool HttpMethod::Fetch(FetchItem *)
// Queue the requests
int Depth = -1;
// Queue the requests
int Depth = -1;
- bool Tail = false;
for (FetchItem *I = Queue; I != 0 && Depth < (signed)PipelineDepth;
I = I->Next, Depth++)
{
for (FetchItem *I = Queue; I != 0 && Depth < (signed)PipelineDepth;
I = I->Next, Depth++)
{
@@
-1008,8
+1008,6
@@
bool HttpMethod::Fetch(FetchItem *)
if (Server->Comp(I->Uri) == false)
break;
if (QueueBack == I)
if (Server->Comp(I->Uri) == false)
break;
if (QueueBack == I)
- Tail = true;
- if (Tail == true)
{
QueueBack = I->Next;
SendReq(I,Server->Out);
{
QueueBack = I->Next;
SendReq(I,Server->Out);
@@
-1071,7
+1069,6
@@
int HttpMethod::Loop()
delete Server;
Server = new ServerState(Queue->Uri,this);
}
delete Server;
Server = new ServerState(Queue->Uri,this);
}
-
/* If the server has explicitly said this is the last connection
then we pre-emptively shut down the pipeline and tear down
the connection. This will speed up HTTP/1.0 servers a tad
/* If the server has explicitly said this is the last connection
then we pre-emptively shut down the pipeline and tear down
the connection. This will speed up HTTP/1.0 servers a tad
@@
-1168,8
+1165,24
@@
int HttpMethod::Loop()
URIDone(Res);
}
else
URIDone(Res);
}
else
- Fail(true);
-
+ {
+ if (Server->ServerFd == -1)
+ {
+ FailCounter++;
+ _error->Discard();
+ Server->Close();
+
+ if (FailCounter >= 2)
+ {
+ Fail(_("Connection failed"),true);
+ FailCounter = 0;
+ }
+
+ QueueBack = Queue;
+ }
+ else
+ Fail(true);
+ }
break;
}
break;
}