From a52a1c2251427a79ec9d0635b0bf9888eb1601e9 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 17 Jul 2013 15:21:59 +0200 Subject: [PATCH] Started work on ,-separated rule set --- src/filter_http_rewrite.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) 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") -- 1.7.10.4