X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Ftest_filter_rewrite.cpp;h=110d6144037ec4d8d29d7e92f4fb2990c22fd67f;hb=586d78659d671683f33ec55f4a7d32b28e345ccd;hp=68acc0f9c165b3c98edf38b03baaba58a22da53f;hpb=c4f5c25488b0ae53e5b856a0c14a4b8c210560fc;p=metaproxy-moved-to-github.git diff --git a/src/test_filter_rewrite.cpp b/src/test_filter_rewrite.cpp index 68acc0f..110d614 100644 --- a/src/test_filter_rewrite.cpp +++ b/src/test_filter_rewrite.cpp @@ -1,5 +1,5 @@ /* This file is part of Metaproxy. - Copyright (C) 2005-2013 Index Data + Copyright (C) Index Data Metaproxy is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -43,7 +43,6 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 ) { try { - std::cout << "Running non-xml config test case" << std::endl; mp::RouterChain router; mp::filter::HttpRewrite fhr; @@ -68,9 +67,11 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 ) " \n" " \n" " \n" + " \n" + " \n" + " \n" " \n" " \n" - " \n" " \n" @@ -82,7 +83,7 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 ) " \n" " \n" " \n" - " \n" + " \n" " \n" " \n" " \n" @@ -108,8 +109,11 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 ) mp::odr odr; Z_GDU *gdu_req = z_get_HTTP_Request_uri(odr, - "http://proxyhost/proxypath/targetsite/page1.html", 0, 1); - + "http://proxyhost/proxypath/targetsite/page1.html", 0, 1); + + Z_HTTP_Request *hreq = gdu_req->u.HTTP_Request; + z_HTTP_header_set(odr, &hreq->headers, + "X-Metaproxy-SkipLink", ".* skiplink.com" ); pack.request() = gdu_req; //create the http response @@ -128,6 +132,7 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 ) "" "" "" "" @@ -139,12 +144,13 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 ) " Another abs link" "" "" - "" + "\n" + "skip\n" ""; const char *resp_expected = "HTTP/1.1 200 OK\r\n" - "Content-Length: 605\r\n" + "Content-Length: 686\r\n" "Content-Type: text/html\r\n" "Link: ; rel=absolute\r\n" "Link: ; rel=relative\r\n" @@ -157,6 +163,7 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 ) "" "" "" "" @@ -168,7 +175,8 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 ) " Another abs link" "" "" - "" + "\n" + "skip\n" ""; Z_GDU *gdu_res; @@ -208,7 +216,7 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 ) { //compare buffers std::cout << "Expected result:\n" << resp_expected << "\n"; - std::cout << "Got result:\n" << "\n"; + std::cout << "Got result:\n"; fflush(stdout); fwrite(resp_result, 1, resp_result_len, stdout); fflush(stdout); @@ -224,12 +232,10 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 ) } } - 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; @@ -355,7 +361,7 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_2 ) { //compare buffers std::cout << "Expected result:\n" << resp_expected << "\n"; - std::cout << "Got result:\n" << "\n"; + std::cout << "Got result:\n"; fflush(stdout); fwrite(resp_result, 1, resp_result_len, stdout); fflush(stdout);