typedef RefCount<ESIContext> Pointer;
void *operator new (size_t byteCount);
void operator delete (void *address);
- ESIContext():reading_(true) {}
+ ESIContext() :
+ thisNode(NULL),
+ http(NULL),
+ errorpage(ERR_NONE),
+ errorstatus(HTTP_STATUS_NONE),
+ errormessage(NULL),
+ rep(NULL),
+ outbound_offset(0),
+ readpos(0),
+ pos(0),
+ varState(NULL),
+ cachedASTInUse(false),
+ reading_(true),
+ processing(false) {
+ memset(&flags, 0, sizeof(flags));
+ }
~ESIContext();
return SearchTrie;
}
-ESICustomParser::ESICustomParser(ESIParserClient *aClient) : theClient (aClient)
+ESICustomParser::ESICustomParser(ESIParserClient *aClient) :
+ theClient(aClient),
+ lastTag(ESITAG)
{}
ESICustomParser::~ESICustomParser()
}
char *value = equals + 1;
- char *end = strchr (value, sep);
+ char *end = strchr(value, sep);
+
+ if (!end) {
+ error = "Missing attribute ending separator (";
+ error.append(sep);
+ error.append(")");
+ return false;
+ }
attributes.push_back(value);
*end = '\0';
attribute = end + 1;
return stack[stackdepth-1];
}
-ESIContext::ParserState::ParserState() : inited_ (false)
+ESIContext::ParserState::ParserState() :
+stackdepth(0),
+parsing(0),
+inited_(false)
{}
bool
esiLiteral::esiLiteral(ESIContext *context, const char *s, int numberOfCharacters)
{
assert (s);
+ flags.donevars = 0;
buffer = new ESISegment;
ESISegment::Pointer local = buffer;
size_t start = 0;
remainingCharacters -= len;
}
- varState = cbdataReference (context->varState);
+ varState = cbdataReference(context->varState);
}
void
debugs(86, 5, "esiTry::~esiTry " << this);
}
-esiTry::esiTry(esiTreeParentPtr aParent) : parent (aParent) , exceptbuffer(NULL)
-{}
+esiTry::esiTry(esiTreeParentPtr aParent) :
+ parent(aParent),
+ exceptbuffer(NULL)
+{
+ memset(&flags, 0, sizeof(flags));
+}
void
-esiTry::render (ESISegment::Pointer output)
+esiTry::render(ESISegment::Pointer output)
{
/* Try renders from it's children */
assert (this);
return;
for (size_t counter = 0; counter < elements.size(); ++counter) {
- if ((dynamic_cast<esiWhen *>(elements[counter].getRaw()))->
- testsTrue()) {
+ const esiWhen *el = dynamic_cast<esiWhen *>(elements[counter].getRaw());
+ if (el && el->testsTrue()) {
chosenelement = counter;
debugs (86,3, "esiChooseAdd: Chose element " << counter + 1);
return;
}
/* esiWhen */
-esiWhen::esiWhen (esiTreeParentPtr aParent, int attrcount, const char **attr,ESIVarState *aVar) : esiSequence (aParent)
+esiWhen::esiWhen(esiTreeParentPtr aParent, int attrcount, const char **attr,ESIVarState *aVar) :
+ esiSequence(aParent),
+ testValue(false),
+ unevaluatedExpression(NULL),
+ varState(NULL)
{
- varState = NULL;
char const *expression = NULL;
for (int loopCounter = 0; loopCounter < attrcount && attr[loopCounter]; loopCounter += 2) {
if (!unevaluatedExpression)
return;
- assert (varState);
+ assert(varState);
varState->feedData(unevaluatedExpression, strlen (unevaluatedExpression));
safe_free (expression);
}
-esiWhen::esiWhen(esiWhen const &old) : esiSequence (old)
+esiWhen::esiWhen(esiWhen const &old) :
+ esiSequence(old),
+ testValue(NULL),
+ unevaluatedExpression(NULL),
+ varState(NULL)
{
- unevaluatedExpression = NULL;
-
if (old.unevaluatedExpression)
unevaluatedExpression = xstrdup(old.unevaluatedExpression);
-
- varState = NULL;
}
ESIElement::Pointer
rv = stack[whereAmI - 1].value.integral || stack[whereAmI + 1].value.integral;
- if (rv == -2)
- /* invalid comparison */
- return 1;
-
stackpop(stack, depth); /* arg rhs */
stackpop(stack, depth); /* me */
rv = stack[whereAmI - 1].value.integral && stack[whereAmI + 1].value.integral;
- if (rv == -2)
- /* invalid comparison */
- return 1;
-
stackpop(stack, depth); /* arg rhs */
stackpop(stack, depth); /* me */
return result;
}
-ESIInclude::ESIInclude(ESIInclude const &old) : parent (NULL), started (false), sent (false)
+ESIInclude::ESIInclude(ESIInclude const &old) :
+ parent(NULL),
+ varState(NULL),
+ srcurl(NULL),
+ alturl(NULL),
+ started(false),
+ sent(false)
{
- varState = NULL;
+ memset(&flags, 0, sizeof(flags));
flags.onerrorcontinue = old.flags.onerrorcontinue;
if (old.srcurl)
tempheaders.clean();
}
-ESIInclude::ESIInclude (esiTreeParentPtr aParent, int attrcount, char const **attr, ESIContext *aContext) : parent (aParent), started (false), sent (false)
+ESIInclude::ESIInclude(esiTreeParentPtr aParent, int attrcount, char const **attr, ESIContext *aContext) :
+ parent(aParent),
+ varState(NULL),
+ srcurl(NULL),
+ alturl(NULL),
+ started(false),
+ sent(false)
{
- int i;
assert (aContext);
+ memset(&flags, 0, sizeof(flags));
- for (i = 0; i < attrcount && attr[i]; i += 2) {
+ for (int i = 0; i < attrcount && attr[i]; i += 2) {
if (!strcmp(attr[i],"src")) {
/* Start a request for thisNode url */
debugs(86, 5, "ESIIncludeNew: Requesting source '" << attr[i+1] << "'");
debugs(86, 5, "esiSequence::~esiSequence " << this);
}
-esiSequence::esiSequence(esiTreeParentPtr aParent, bool incrementalFlag) : elements(), parent (aParent), mayFail_(true), failed (false), provideIncrementalData (incrementalFlag), processing (false), processingResult (ESI_PROCESS_COMPLETE), nextElementToProcess_ (0)
-{}
+esiSequence::esiSequence(esiTreeParentPtr aParent, bool incrementalFlag) :
+ elements(),
+ processedcount(0),
+ parent(aParent),
+ mayFail_(true),
+ failed(false),
+ provideIncrementalData(incrementalFlag),
+ processing(false),
+ processingResult(ESI_PROCESS_COMPLETE),
+ nextElementToProcess_(0)
+{
+ memset(&flags, 0, sizeof(flags));
+}
size_t
esiSequence::nextElementToProcess() const
parent = NULL;
}
-esiSequence::esiSequence(esiSequence const &old)
- : processedcount (0), mayFail_(old.mayFail_), failed (old.failed), provideIncrementalData (old.provideIncrementalData), processing (false), nextElementToProcess_ (0)
+esiSequence::esiSequence(esiSequence const &old) :
+ processedcount(0),
+ parent(NULL),
+ mayFail_(old.mayFail_),
+ failed(old.failed),
+ provideIncrementalData(old.provideIncrementalData),
+ processing(false),
+ processingResult(ESI_PROCESS_COMPLETE),
+ nextElementToProcess_(0)
{
flags.dovars = old.flags.dovars;
- parent = NULL;
}
void
safe_free (query_string);
}
-ESIVarState::ESIVarState (HttpHeader const *aHeader, char const *uri)
- : output (NULL), hdr(hoReply)
+ESIVarState::ESIVarState(HttpHeader const *aHeader, char const *uri) :
+ output(NULL),
+ hdr(hoReply)
{
+ memset(&flags, 0, sizeof(flags));
+
/* TODO: only grab the needed headers */
/* Note that as we pass these through to included requests, we
* cannot trim them */