+ HTMLParser parser;
+ Event ev(this, vars);
+
+ parser.set_verbose(m_verbose);
+
+ std::string buf(*content_buf, *content_len);
+
+ parser.parse(ev, buf.c_str());
+ const char *res = ev.result();
+ *content_buf = odr_strdup(o, res);
+ *content_len = strlen(res);
+ }
+}
+
+yf::HttpRewrite::Event::Event(const Phase *p,
+ std::map<std::string, std::string> & vars
+ ) : m_phase(p), m_vars(vars)
+{
+ m_w = wrbuf_alloc();
+}
+
+yf::HttpRewrite::Event::~Event()
+{
+ wrbuf_destroy(m_w);
+}
+
+const char *yf::HttpRewrite::Event::result()
+{
+ return wrbuf_cstr(m_w);
+}
+
+void yf::HttpRewrite::Event::openTagStart(const char *tag, int tag_len)
+{
+ wrbuf_putc(m_w, '<');
+ wrbuf_write(m_w, tag, tag_len);
+
+ std::string t(tag, tag_len);
+ std::list<Within>::const_iterator it = m_phase->within_list.begin();
+ for (; it != m_phase->within_list.end(); it++)
+ {
+ if (it->tag.length() > 0 && yaz_strcasecmp(it->tag.c_str(),
+ t.c_str()) == 0)