summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2020-08-10 12:15:02 +0000
committerJulian Andres Klode <jak@debian.org>2020-08-10 12:15:02 +0000
commitfc0fcaca622c0d075499c337451e76b905c5e024 (patch)
tree41f04588a0e1f092efc425dff502a3d3e6298c9a
parent3921bdfec6926c5db6d052683a21339c76fb8600 (diff)
parentfa375493c5a4ed9c10d4e5257ac82c6e687862d3 (diff)
Merge branch 'pu/http-fix-infinite-loop' into 'master'
http: Fix infinite loop on read errors See merge request apt-team/apt!126
-rw-r--r--methods/basehttp.cc39
1 files changed, 15 insertions, 24 deletions
diff --git a/methods/basehttp.cc b/methods/basehttp.cc
index e659da255..b8ab73155 100644
--- a/methods/basehttp.cc
+++ b/methods/basehttp.cc
@@ -770,33 +770,24 @@ int BaseHttpMethod::Loop()
}
else
{
- if (Server->IsOpen() == false)
+ if (not Server->IsOpen())
{
- FailCounter++;
- _error->Discard();
- Server->Close();
-
- if (FailCounter >= 2)
- {
- Fail(_("Connection failed"),true);
- FailCounter = 0;
- }
-
+ // Reset the pipeline
QueueBack = Queue;
+ Server->PipelineAnswersReceived = 0;
}
- else
- {
- Server->Close();
- switch (Result)
- {
- case ResultState::TRANSIENT_ERROR:
- Fail(true);
- break;
- case ResultState::FATAL_ERROR:
- case ResultState::SUCCESSFUL:
- Fail(false);
- break;
- }
+
+ Server->Close();
+ FailCounter = 0;
+ switch (Result)
+ {
+ case ResultState::TRANSIENT_ERROR:
+ Fail(true);
+ break;
+ case ResultState::FATAL_ERROR:
+ case ResultState::SUCCESSFUL:
+ Fail(false);
+ break;
}
}
break;