--------------------- PatchSet 129 Date: 2002/11/04 13:04:04 Author: rbcollins Branch: esi Tag: (none) Log: step towards three-step processing Members: src/ESI.cc:1.1.2.36->1.1.2.37 Index: squid3/src/ESI.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ESI.cc,v retrieving revision 1.1.2.36 retrieving revision 1.1.2.37 diff -u -r1.1.2.36 -r1.1.2.37 --- squid3/src/ESI.cc 4 Nov 2002 12:26:01 -0000 1.1.2.36 +++ squid3/src/ESI.cc 4 Nov 2002 13:04:04 -0000 1.1.2.37 @@ -1,6 +1,6 @@ /* - * $Id: ESI.cc,v 1.1.2.36 2002/11/04 12:26:01 rbcollins Exp $ + * $Id: ESI.cc,v 1.1.2.37 2002/11/04 13:04:04 rbcollins Exp $ * * DEBUG: section 86 ESI processing * AUTHOR: Robert Collins @@ -448,7 +448,8 @@ void fail (); void freeResources(); void fixupOutboundTail(); - size_t send (clientStreamNode *thisNode); + void trimBlanks(); + size_t send (); }; CBDATA_TYPE(esiContext); @@ -567,7 +568,7 @@ tree->render(outboundtail); fixupOutboundTail(); /* Is there data to send? */ - if (send (thisNode)) { + if (send ()) { /* some data was sent. we're finished until the next read */ --flags.kicked; return ESI_KICK_SENT; @@ -704,13 +705,9 @@ } } -/* Send data downstream - * Returns 0 if nothing was sent. Non-zero if data was sent. - */ -size_t -esiContext::send (clientStreamNode *thisNode) +void +esiContext::trimBlanks() { - /* send any processed data */ /* trim leading empty buffers ? */ while (outbound && outbound->next && !outbound->len) { @@ -718,6 +715,17 @@ cbdataFree (outbound); outbound = temp; } +} + +/* Send data downstream + * Returns 0 if nothing was sent. Non-zero if data was sent. + */ +size_t +esiContext::send () +{ + /* send any processed data */ + + trimBlanks(); if (!flags.clientwantsdata) { debug (86,5)("esiSend: Client does not want data - not sending anything\n"); @@ -1460,7 +1468,7 @@ /* the esiCode now thinks that the error is the outbound, * and all processing has finished. */ /* Send as much as we can */ - assert (send (thisNode)); + assert (send ()); /* don't cancel anything. The stream nodes will clean up after * themselves when the reply is freed - and we don't know what to * clean anyway.