class HttpRewrite::Phase {
public:
+ Phase();
std::list<Within> within_list;
+ int m_verbose;
void rewrite_reqline(mp::odr & o, Z_HTTP_Request *hreq,
std::map<std::string, std::string> & vars) const;
void rewrite_headers(mp::odr & o, Z_HTTP_Header *headers,
HTMLParser parser;
Event ev(this, vars);
+
+ parser.set_verbose(m_verbose);
+
std::string buf(*content_buf, *content_len);
parser.parse(ev, buf.c_str());
if (it->tag.length() > 0 && yaz_strcasecmp(it->tag.c_str(),
t.c_str()) == 0)
{
- enabled_within = it;
+ std::vector<std::string> attr;
+ boost::split(attr, it->attr, boost::is_any_of(","));
+ size_t i;
+ for (i = 0; i < attr.size(); i++)
+ {
+ if (attr[i].compare("#text") == 0)
+ {
+ enabled_within = it;
+ break;
+ }
+ }
}
}
}
return out;
}
+yf::HttpRewrite::Phase::Phase() : m_verbose(0)
+{
+}
void yf::HttpRewrite::configure_phase(const xmlNode *ptr, Phase &phase)
{
+ static const char *names[2] = { "verbose", 0 };
+ std::string values[1];
+ values[0] = "0";
+ mp::xml::parse_attr(ptr, names, values);
+
+ phase.m_verbose = atoi(values[0].c_str());
+
std::map<std::string, RulePtr > rules;
for (ptr = ptr->children; ptr; ptr = ptr->next)
{
"<?xml version='1.0'?>\n"
"<filter xmlns='http://indexdata.com/metaproxy'\n"
" id='rewrite1' type='http_rewrite'>\n"
- " <request>\n"
+ " <request verbose=\"1\">\n"
" <rule name=\"null\"/>\n"
" <rule name=\"url\">\n"
" <rewrite from='"
" <within header=\"link\" rule=\"null\"/>\n"
" <within reqline=\"1\" rule=\"url\"/>\n"
" </request>\n"
- " <response>\n"
+ " <response verbose=\"1\">\n"
" <rule name=\"null\"/>\n"
" <rule name=\"url\">\n"
" <rewrite from='"
" to='${proto}${pxhost}/${pxpath}/${host}/${path}' />\n"
" </rule>\n"
" <within header=\"link\" rule=\"url\"/>\n"
- " <within tag=\"script\" attr=\"src,#text\" rule=\"url\"/>\n"
- " <within tag=\"style\" rule=\"url\"/>\n"
+ " <within tag=\"body\" attr=\"background\" rule=\"null\"/>\n"
+ " <within tag=\"script\" attr=\"#text\" rule=\"url\"/>\n"
+ " <within tag=\"style\" attr=\"#text\" rule=\"url\"/>\n"
" <within attr=\"href,src\" rule=\"url\"/>\n"
" </response>\n"
"</filter>\n"