summaryrefslogtreecommitdiff
path: root/methods/server.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-08-11 16:59:13 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2016-08-16 18:49:37 +0200
commitebdb6f1810a20ac240b5b2192dc2e6532ff149d2 (patch)
tree5f3523913c4de3abc95165ac17c1d7c2ad50bce2 /methods/server.cc
parent1bb40ea62efc5eafc93d3739c9082e8f7e1a0e53 (diff)
reorganize server-states resetting in http/https
We keep various information bits about the server around, some only effecting the currently handled file (like sizes) while others should be persistent (like pipeline detections). http used to reset all file-related manually, which is a bit silly if we already have a Reset() method – which does reset all through –, so extending it with a parameter for reuse and calling it from https too (as this was previously resetting by just creating a new state struct – it uses no value of the persistent state-keeping yet as it supports no pipelining). Gbp-Dch: Ignore
Diffstat (limited to 'methods/server.cc')
-rw-r--r--methods/server.cc25
1 files changed, 13 insertions, 12 deletions
diff --git a/methods/server.cc b/methods/server.cc
index 3f0e88457..d0b6ef3d7 100644
--- a/methods/server.cc
+++ b/methods/server.cc
@@ -46,20 +46,9 @@ time_t ServerMethod::FailTime = 0;
ServerState::RunHeadersResult ServerState::RunHeaders(FileFd * const File,
const std::string &Uri)
{
- State = Header;
-
+ Reset(false);
Owner->Status(_("Waiting for headers"));
- Major = 0;
- Minor = 0;
- Result = 0;
- TotalFileSize = 0;
- JunkSize = 0;
- StartPos = 0;
- Encoding = Closes;
- HaveContent = false;
- time(&Date);
-
do
{
string Data;
@@ -254,6 +243,18 @@ bool ServerState::AddPartialFileToHashes(FileFd &File) /*{{{*/
return GetHashes()->AddFD(File, StartPos);
}
/*}}}*/
+void ServerState::Reset(bool const Everything) /*{{{*/
+{
+ Major = 0; Minor = 0; Result = 0; Code[0] = '\0';
+ TotalFileSize = 0; JunkSize = 0; StartPos = 0;
+ Encoding = Closes; time(&Date); HaveContent = false;
+ State = Header; MaximumSize = 0;
+ if (Everything)
+ {
+ Persistent = false; Pipeline = false; PipelineAllowed = true;
+ }
+}
+ /*}}}*/
// ServerMethod::DealWithHeaders - Handle the retrieved header data /*{{{*/
// ---------------------------------------------------------------------