("Empty rule in '" + values[3] +
"' in http_rewrite filter");
}
- size_t i;
- for (i = 0; i < rulenames.size(); i++)
+ else if (rulenames.size() == 1)
{
std::map<std::string,RulePtr>::const_iterator it =
- rules.find(rulenames[i]);
+ rules.find(rulenames[0]);
if (it == rules.end())
throw mp::filter::FilterException
- ("Reference to non-existing rule '" + rulenames[i] +
+ ("Reference to non-existing rule '" + rulenames[0] +
"' in http_rewrite filter");
- if (i == 0)
- w.rule = it->second;
+ w.rule = it->second;
+
+ }
+ else
+ {
+ RulePtr rule(new Rule);
+ size_t i;
+ for (i = 0; i < rulenames.size(); i++)
+ {
+ std::map<std::string,RulePtr>::const_iterator it =
+ rules.find(rulenames[i]);
+ if (it == rules.end())
+ throw mp::filter::FilterException
+ ("Reference to non-existing rule '" + rulenames[i] +
+ "' in http_rewrite filter");
+ RulePtr subRule = it->second;
+ std::list<Replace>::iterator rit =
+ subRule->replace_list.begin();
+ for (; rit != subRule->replace_list.end(); rit++)
+ rule->replace_list.push_back(*rit);
+ }
+ w.rule = rule;
}
w.reqline = values[4] == "1";
w.type = values[5];
" </request>\n"
" <response verbose=\"1\">\n"
" <rule name=\"null\"/>\n"
+ " <rule name=\"cx\">\n"
+ " <rewrite from='^cx' to='cy'/>\n"
+ " </rule>\n"
" <rule name=\"url\">\n"
" <rewrite from='foo' to='bar'/>\n"
- " <rewrite from='^cx' to='cy'/>\n"
" <rewrite from='"
"(?<proto>https?://)(?<host>[^/?# "'>]+)/(?<path>[^ "'>]+)'\n"
" to='${proto}${pxhost}/${pxpath}/${host}/${path}' />\n"
" <within tag=\"body\" attr=\"background\" rule=\"null\"/>\n"
" <within tag=\"script\" attr=\"#text\" type=\"quoted-literal\" rule=\"url\"/>\n"
" <within tag=\"style\" attr=\"#text\" rule=\"url\"/>\n"
- " <within attr=\"href|src\" rule=\"url\"/>\n"
+ " <within attr=\"href|src\" rule=\"url,cx\"/>\n"
" <within attr=\"onclick\" type=\"quoted-literal\" rule=\"url\"/>\n"
" </content>\n"
" <content type=\"quoted-literal\" mime=\".*javascript\">\n"