From: Adam Dickmeiss Date: Wed, 17 Jul 2013 13:21:59 +0000 (+0200) Subject: Started work on ,-separated rule set X-Git-Tag: v1.3.60~10 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=a52a1c2251427a79ec9d0635b0bf9888eb1601e9;p=metaproxy-moved-to-github.git Started work on ,-separated rule set --- diff --git a/src/filter_http_rewrite.cpp b/src/filter_http_rewrite.cpp index cb005e9..9ef4de2 100644 --- a/src/filter_http_rewrite.cpp +++ b/src/filter_http_rewrite.cpp @@ -715,13 +715,27 @@ void yf::HttpRewrite::Content::configure( w.attr.assign(values[1], boost::regex_constants::icase); if (values[2].length() > 0) w.tag.assign(values[2], boost::regex_constants::icase); - std::map::const_iterator it = - rules.find(values[3]); - if (it == rules.end()) + + std::vector rulenames; + boost::split(rulenames, values[3], boost::is_any_of(",")); + if (rulenames.size() == 0) + { throw mp::filter::FilterException - ("Reference to non-existing rule '" + values[3] + + ("Empty rule in '" + values[3] + "' in http_rewrite filter"); - w.rule = it->second; + } + size_t i; + for (i = 0; i < rulenames.size(); i++) + { + std::map::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"); + if (i == 0) + w.rule = it->second; + } w.reqline = values[4] == "1"; w.type = values[5]; if (w.type.empty() || w.type == "quoted-literal")