summaryrefslogtreecommitdiff
path: root/methods/server.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2014-08-26 19:08:37 -0700
committerMichael Vogt <mvo@debian.org>2014-08-26 19:08:37 -0700
commitdcd5856b11c685ca6d4629212d2978ce196ea65c (patch)
tree932d7934b144353010d85eff5eb76324b39554c4 /methods/server.cc
parent80624be7c54aec6ed98ee254366155024fca1a71 (diff)
Pass ExpectedSize to tthe backend method
This ensures that we can stop downloading if the server send too much data by accident (or by a malicious attempt)
Diffstat (limited to 'methods/server.cc')
-rw-r--r--methods/server.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/methods/server.cc b/methods/server.cc
index c91d3b218..1b6511c59 100644
--- a/methods/server.cc
+++ b/methods/server.cc
@@ -531,6 +531,11 @@ int ServerMethod::Loop()
// Run the data
bool Result = true;
+
+ // ensure we don't fetch too much
+ if (Queue->ExpectedSize > 0)
+ Server->ExpectedSize = Queue->ExpectedSize;
+
if (Server->HaveContent)
Result = Server->RunData(File);