summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--methods/basehttp.cc36
-rw-r--r--methods/basehttp.h8
2 files changed, 22 insertions, 22 deletions
diff --git a/methods/basehttp.cc b/methods/basehttp.cc
index 617a8f5d5..9ed308116 100644
--- a/methods/basehttp.cc
+++ b/methods/basehttp.cc
@@ -76,7 +76,7 @@ ServerState::RunHeadersResult ServerState::RunHeaders(RequestState &Req,
continue;
// Tidy up the connection persistence state.
- if (Req.Encoding == RequestState::Closes && Req.haveContent == HaveContent::TRUE)
+ if (Req.Encoding == RequestState::Closes && Req.haveContent == HaveContent::TRI_TRUE)
Persistent = false;
return RUN_HEADERS_OK;
@@ -157,12 +157,12 @@ bool RequestState::HeaderLine(string const &Line) /*{{{*/
auto ContentLength = strtoull(Val.c_str(), NULL, 10);
if (ContentLength == 0)
{
- haveContent = HaveContent::FALSE;
+ haveContent = HaveContent::TRI_FALSE;
return true;
}
if (Encoding == Closes)
Encoding = Stream;
- haveContent = HaveContent::TRUE;
+ haveContent = HaveContent::TRI_TRUE;
unsigned long long * DownloadSizePtr = &DownloadSize;
if (Result == 416 || (Result >= 300 && Result < 400))
@@ -172,7 +172,7 @@ bool RequestState::HeaderLine(string const &Line) /*{{{*/
if (*DownloadSizePtr >= std::numeric_limits<unsigned long long>::max())
return _error->Errno("HeaderLine", _("The HTTP server sent an invalid Content-Length header"));
else if (*DownloadSizePtr == 0)
- haveContent = HaveContent::FALSE;
+ haveContent = HaveContent::TRI_FALSE;
// On partial content (206) the Content-Length less than the real
// size, so do not set it here but leave that to the Content-Range
@@ -185,8 +185,8 @@ bool RequestState::HeaderLine(string const &Line) /*{{{*/
if (stringcasecmp(Tag,"Content-Type:") == 0)
{
- if (haveContent == HaveContent::UNKNOWN)
- haveContent = HaveContent::TRUE;
+ if (haveContent == HaveContent::TRI_UNKNOWN)
+ haveContent = HaveContent::TRI_TRUE;
return true;
}
@@ -196,8 +196,8 @@ bool RequestState::HeaderLine(string const &Line) /*{{{*/
// for such responses.
if ((Result == 416 || Result == 206) && stringcasecmp(Tag,"Content-Range:") == 0)
{
- if (haveContent == HaveContent::UNKNOWN)
- haveContent = HaveContent::TRUE;
+ if (haveContent == HaveContent::TRI_UNKNOWN)
+ haveContent = HaveContent::TRI_TRUE;
// ยง14.16 says 'byte-range-resp-spec' should be a '*' in case of 416
if (Result == 416 && sscanf(Val.c_str(), "bytes */%llu",&TotalFileSize) == 1)
@@ -214,8 +214,8 @@ bool RequestState::HeaderLine(string const &Line) /*{{{*/
if (stringcasecmp(Tag,"Transfer-Encoding:") == 0)
{
- if (haveContent == HaveContent::UNKNOWN)
- haveContent = HaveContent::TRUE;
+ if (haveContent == HaveContent::TRI_UNKNOWN)
+ haveContent = HaveContent::TRI_TRUE;
if (stringcasecmp(Val,"chunked") == 0)
Encoding = Chunked;
return true;
@@ -362,7 +362,7 @@ BaseHttpMethod::DealWithHeaders(FetchResult &Res, RequestState &Req)
{
SetFailReason("RedirectionLoop");
_error->Error("Redirection loop encountered");
- if (Req.haveContent == HaveContent::TRUE)
+ if (Req.haveContent == HaveContent::TRI_TRUE)
return ERROR_WITH_CONTENT_PAGE;
return ERROR_UNRECOVERABLE;
}
@@ -379,7 +379,7 @@ BaseHttpMethod::DealWithHeaders(FetchResult &Res, RequestState &Req)
if (tmpURI.Access.find('+') != std::string::npos)
{
_error->Error("Server tried to trick us into using a specific implementation: %s", tmpURI.Access.c_str());
- if (Req.haveContent == HaveContent::TRUE)
+ if (Req.haveContent == HaveContent::TRI_TRUE)
return ERROR_WITH_CONTENT_PAGE;
return ERROR_UNRECOVERABLE;
}
@@ -405,7 +405,7 @@ BaseHttpMethod::DealWithHeaders(FetchResult &Res, RequestState &Req)
{
SetFailReason("RedirectionLoop");
_error->Error("Redirection loop encountered");
- if (Req.haveContent == HaveContent::TRUE)
+ if (Req.haveContent == HaveContent::TRI_TRUE)
return ERROR_WITH_CONTENT_PAGE;
return ERROR_UNRECOVERABLE;
}
@@ -465,11 +465,11 @@ BaseHttpMethod::DealWithHeaders(FetchResult &Res, RequestState &Req)
if (partialHit == true)
{
// the file is completely downloaded, but was not moved
- if (Req.haveContent == HaveContent::TRUE)
+ if (Req.haveContent == HaveContent::TRI_TRUE)
{
// nuke the sent error page
Server->RunDataToDevNull(Req);
- Req.haveContent = HaveContent::FALSE;
+ Req.haveContent = HaveContent::TRI_FALSE;
}
Req.StartPos = Req.TotalFileSize;
Req.Result = 200;
@@ -493,7 +493,7 @@ BaseHttpMethod::DealWithHeaders(FetchResult &Res, RequestState &Req)
SetFailReason(err);
_error->Error("%u %s", Req.Result, Req.Code);
}
- if (Req.haveContent == HaveContent::TRUE)
+ if (Req.haveContent == HaveContent::TRI_TRUE)
return ERROR_WITH_CONTENT_PAGE;
return ERROR_UNRECOVERABLE;
}
@@ -732,7 +732,7 @@ int BaseHttpMethod::Loop()
// so instead we use the size of the biggest item in the queue
Req.MaximumSize = FindMaximumObjectSizeInQueue();
- if (Req.haveContent == HaveContent::TRUE)
+ if (Req.haveContent == HaveContent::TRI_TRUE)
{
/* If the server provides Content-Length we can figure out with it if
this satisfies any request we have made so far (in the pipeline).
@@ -894,7 +894,7 @@ int BaseHttpMethod::Loop()
case TRY_AGAIN_OR_REDIRECT:
{
// Clear rest of response if there is content
- if (Req.haveContent == HaveContent::TRUE)
+ if (Req.haveContent == HaveContent::TRI_TRUE)
Server->RunDataToDevNull(Req);
Redirect(NextURI);
break;
diff --git a/methods/basehttp.h b/methods/basehttp.h
index 2a13c7abf..0f776b0a8 100644
--- a/methods/basehttp.h
+++ b/methods/basehttp.h
@@ -29,9 +29,9 @@ struct ServerState;
enum class HaveContent
{
- UNKNOWN,
- FALSE,
- TRUE,
+ TRI_UNKNOWN,
+ TRI_FALSE,
+ TRI_TRUE,
};
struct RequestState
{
@@ -52,7 +52,7 @@ struct RequestState
unsigned long long MaximumSize = 0;
time_t Date;
- HaveContent haveContent = HaveContent::UNKNOWN;
+ HaveContent haveContent = HaveContent::TRI_UNKNOWN;
enum {Chunked,Stream,Closes} Encoding = Closes;
enum {Header, Data} State = Header;