/* * $Id: ESICustomParser.cc,v 1.10 2007/05/29 13:31:37 amosjeffries Exp $ * * DEBUG: section 86 ESI processing * AUTHOR: Robert Collins * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- * * Squid is the result of efforts by numerous individuals from * the Internet community; see the CONTRIBUTORS file for full * details. Many organizations have provided support for Squid's * development; see the SPONSORS file for full details. Squid is * Copyrighted (C) 2001 by the Regents of the University of * California; see the COPYRIGHT file for full details. Squid * incorporates software developed and/or copyrighted by other * sources; see the CREDITS file for full details. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. * */ #include "squid.h" #include "ESICustomParser.h" #include "Trie.h" #include "TrieCharTransform.h" #include "Array.h" Trie *ESICustomParser::SearchTrie=NULL; RegisterESIParser("custom", ESICustomParser); Trie * ESICustomParser::GetTrie() { if (SearchTrie) return SearchTrie; SearchTrie = new Trie(new TrieCaseless); static const ESITAG_t ESITAG_value = ESITAG; assert (SearchTrie->add ("add ("add (""); if (!commentEnd) { error = "missing end of comment"; return false; } if (commentEnd - tag > (ssize_t)remainingCount) { error = "comment ends beyond parse buffer"; return false; } *commentEnd = '\0'; theClient->parserComment (tag + 4); remainingCount -= commentEnd - currentPos + 3; currentPos = commentEnd + 3; } break; break; default: fatal ("unknown ESI tag type found"); }; /* * Find next esi tag (open or closing) or comment * send tag, or full comment text * rinse */ } if (remainingCount) theClient->parserDefault (currentPos,remainingCount); debugs(86, 5, "ESICustomParser::parse: Finished parsing, will return " << !openESITags); if (openESITags) error = "ESI Tags still open"; return !openESITags; } long int ESICustomParser::lineNumber() const { /* We don't track lines in the body */ return 0; } char const * ESICustomParser::errorString() const { if (error.size()) return error.buf(); else return "Parsing error strings not implemented"; }