--------------------- PatchSet 123 Date: 2002/11/02 12:53:57 Author: rbcollins Branch: esi Tag: (none) Log: start refactoring esiVarState Members: src/ESI.cc:1.1.2.31->1.1.2.32 Index: squid3/src/ESI.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ESI.cc,v retrieving revision 1.1.2.31 retrieving revision 1.1.2.32 diff -u -r1.1.2.31 -r1.1.2.32 --- squid3/src/ESI.cc 2 Nov 2002 12:21:47 -0000 1.1.2.31 +++ squid3/src/ESI.cc 2 Nov 2002 12:53:57 -0000 1.1.2.32 @@ -1,6 +1,6 @@ /* - * $Id: ESI.cc,v 1.1.2.31 2002/11/02 12:21:47 rbcollins Exp $ + * $Id: ESI.cc,v 1.1.2.32 2002/11/02 12:53:57 rbcollins Exp $ * * DEBUG: section 86 ESI processing * AUTHOR: Robert Collins @@ -115,6 +115,8 @@ void freeResources(); esiVarState (HttpHeader const *hdr, char const *uri); +private: + esiSegment *input; esiSegment *output; HttpHeader hdr; struct _query_elem *query; @@ -130,7 +132,6 @@ } flags; esiBrowser_t browser; char *browserversion; -private: enum esiVar_t { ESI_VAR_LANGUAGE, ESI_VAR_COOKIE, @@ -1812,7 +1813,7 @@ void esiLiteral::render (esiSegment *output) { - debug (86,9)("esiLiteral::render: Rending %p\n",this); + debug (86,9)("esiLiteral::render: Rendering %p\n",this); /* append the entire chain */ esiSegment *myout = output; assert (myout->next == NULL); @@ -1828,7 +1829,6 @@ if (dovars) { esiSegment *temp = buffer; /* Ensure variable state is clean */ - assert (varState->output == NULL); while (temp) { varState->feedData(temp->buf,temp->len); temp = temp->next; @@ -2027,7 +2027,6 @@ httpHeaderInit (&tempheaders, hoRequest); /* Ensure variable state is clean */ - assert (vars->output == NULL); vars->feedData(url, strlen (url)); safe_free (url); /* url is eaten by the request */ @@ -2570,6 +2569,7 @@ } esiVarState::esiVarState (HttpHeader const *aHeader, char const *uri) + : output (NULL) { char const *query_pos; char const *query_start; @@ -2692,7 +2692,7 @@ { /* TODO: if needed - tune to skip segment iteration */ debug (86,6)("esiVarState::feedData: accepting %d bytes\n", len); - esiSegmentListAppend (&output, buf, len); + esiSegmentListAppend (&input, buf, len); } esiSegment * @@ -2708,7 +2708,7 @@ char * esiVarState::extractChar () { - if (!output) + if (!input) fatal ("Attempt to extract variable state with no data fed in \n"); doIt(); char *rv = esiSegmentListToChar(output); @@ -2907,8 +2907,9 @@ void esiVarState::doIt () { + assert (output == NULL); int state = 0; - char *string = esiSegmentListToChar(output); + char *string = esiSegmentListToChar(input); size_t len = strlen (string); size_t pos = 0; size_t var_pos = 0; @@ -2916,7 +2917,7 @@ char * found_subref = NULL; char *found_default = NULL; esiVar_t vartype = ESI_VAR_OTHER; - esiSegmentFreeList (&output); + esiSegmentFreeList (&input); while (pos < len) { switch (state) { case 0: /* skipping pre-variables */