X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Ftest_filter_rewrite.cpp;h=110d6144037ec4d8d29d7e92f4fb2990c22fd67f;hb=86ca80da550dc8b26d253b74f43d8ff376216ab2;hp=c38c022509e7783be29e613ab3f4b475bd4aa9f0;hpb=2c02be2dd0d82a2ce2db3050ce3a6bfe0a3ef16b;p=metaproxy-moved-to-github.git
diff --git a/src/test_filter_rewrite.cpp b/src/test_filter_rewrite.cpp
index c38c022..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
@@ -38,29 +38,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
using namespace boost::unit_test;
namespace mp = metaproxy_1;
-/*
- * The global testconfig is commented out, as it won't even compile
- * on old Centos5 machines
-struct TestConfig {
- TestConfig()
- {
- std::cout << "global setup\n";
- yaz_log_init_level(YLOG_ALL);
- }
- ~TestConfig()
- {
- std::cout << "global teardown\n";
- }
-};
-
-BOOST_GLOBAL_FIXTURE( TestConfig );
-*/
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;
@@ -69,31 +51,44 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 )
"\n"
" \n"
- " \n"
- " \n"
+ " \n"
+ " \n"
" \n"
" \n"
- " \n"
- " \n"
- " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
" \n"
" \n"
- " \n"
- " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
" \n"
" \n"
" \n"
- " \n"
- " \n"
- " \n"
- " \n"
- " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
" \n"
"\n"
;
@@ -114,15 +109,17 @@ 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
const char *resp_buf =
"HTTP/1.1 200 OK\r\n"
- "Content-Length: 441\r\n"
"Content-Type: text/html\r\n"
"Link: ; rel=absolute\r\n"
"Link: ; rel=relative\r\n"
@@ -135,7 +132,8 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 )
""
""
""
""
"
Welcome to our website. It doesn't make it easy to get pro"
@@ -145,11 +143,14 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 )
""
" Another abs link"
""
+ ""
+ "\n"
+ "skip\n"
"