+ }
+ catch (std::exception & e) {
+ std::cout << e.what();
+ std::cout << std::endl;
+ BOOST_CHECK (false);
+ }
+}
+
+
+BOOST_AUTO_TEST_CASE( test_filter_rewrite_2 )
+{
+ try
+ {
+ std::cout << "Running non-xml config test case" << std::endl;
+ mp::RouterChain router;
+ mp::filter::HttpRewrite fhr;
+
+ std::string xmlconf =
+ "<?xml version='1.0'?>\n"
+ "<filter xmlns='http://indexdata.com/metaproxy'\n"
+ " id='rewrite1' type='http_rewrite'>\n"
+ " <request verbose=\"1\">\n"
+ " <rule name=\"null\"/>\n"
+ " <rule name=\"url\">\n"
+ " <rewrite from='"
+ "(?<proto>https?://)(?<pxhost>[^ /?#]+)/(?<pxpath>[^ /]+)"
+ "/(?<host>[^ /]+)(?<path>[^ ]*)'\n"
+ " to='${proto}${host}${path}' />\n"
+ " <rewrite from='(?:Host: )(.*)'\n"
+ " to='Host: ${host}' />\n"
+ " </rule>\n"
+ " <content type=\"headers\">\n"
+ " <within header=\"link\" rule=\"null\"/>\n"
+ " <within reqline=\"1\" rule=\"url\"/>\n"
+ " </content>\n"
+ " </request>\n"
+ " <response verbose=\"1\">\n"
+ " <rule name=\"null\"/>\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"
+ " </rule>\n"
+ " <content type=\"headers\">\n"
+ " <within header=\"link\" rule=\"url\"/>\n"
+ " </content>\n"
+ " <content type=\"html\" mime=\"text/xml|text/html\">\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"
+ " </content>\n"
+ " <content type=\"quoted-literal\" mime=\".*javascript\">\n"
+ " <within rule=\"url\"/>\n"
+ " </content>\n"
+ " </response>\n"
+ "</filter>\n"
+ ;