From 779166ef71fd082438f80b1e6af6dbaeb4310eab Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 30 Jun 2009 11:50:33 +0200 Subject: [PATCH] Allow control of pass-through of vhosts for virt_db A new element in virt_db 'pass-vhosts' has a boolean value. If true, it the virt_db passes vhost-enabled sessions - that is leaving them untouched. This was also the old behavior of MP. A value of false will make virt_db always inspect a Z39.50 session regardless of whether vhost was set or not. This is new and default behavior. --- src/filter_virt_db.cpp | 17 +++++++++++++---- xml/schema/metaproxy.rnc | 1 + xml/schema/metaproxy.rng | 5 +++++ xml/schema/metaproxy.xsd | 2 ++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/filter_virt_db.cpp b/src/filter_virt_db.cpp index bd013e1..95821e4 100644 --- a/src/filter_virt_db.cpp +++ b/src/filter_virt_db.cpp @@ -110,6 +110,7 @@ namespace metaproxy_1 { boost::mutex m_mutex; boost::condition m_cond_session_ready; std::map m_clients; + bool pass_vhosts; }; } } @@ -472,6 +473,7 @@ yf::VirtualDB::Map::Map() yf::VirtualDB::VirtualDB() : m_p(new VirtualDB::Rep) { + m_p->pass_vhosts = false; } yf::VirtualDB::~VirtualDB() { @@ -697,7 +699,12 @@ void yf::VirtualDB::process(mp::Package &package) const std::list vhosts; mp::util::get_vhost_otherinfo(req->otherInfo, vhosts); - if (vhosts.size() == 0) + + if (vhosts.size() > 0 && m_p->pass_vhosts) + { + package.move(); + } + else { f->m_init_gdu = gdu; @@ -732,8 +739,6 @@ void yf::VirtualDB::process(mp::Package &package) const package.response() = apdu; f->m_is_virtual = true; } - else - package.move(); } else if (!f->m_is_virtual) package.move(); @@ -788,7 +793,11 @@ void mp::filter::VirtualDB::configure(const xmlNode * ptr, bool test_only) { if (ptr->type != XML_ELEMENT_NODE) continue; - if (!strcmp((const char *) ptr->name, "virtual")) + if (!strcmp((const char *) ptr->name, "pass-vhosts")) + { + m_p->pass_vhosts = mp::xml::get_bool(ptr->children, false); + } + else if (!strcmp((const char *) ptr->name, "virtual")) { std::string database; std::list targets; diff --git a/xml/schema/metaproxy.rnc b/xml/schema/metaproxy.rnc index 440a4ea..6e1aabb 100644 --- a/xml/schema/metaproxy.rnc +++ b/xml/schema/metaproxy.rnc @@ -186,6 +186,7 @@ filter_virt_db = attribute type { "virt_db" }, attribute id { xsd:NCName }?, attribute name { xsd:NCName }?, + element mp:pass-vhosts { xsd:boolean }?, element mp:virtual { attribute route { xsd:NCName }?, element mp:database { xsd:NCName }, diff --git a/xml/schema/metaproxy.rng b/xml/schema/metaproxy.rng index bebd320..54c54fc 100644 --- a/xml/schema/metaproxy.rng +++ b/xml/schema/metaproxy.rng @@ -477,6 +477,11 @@ + + + + + diff --git a/xml/schema/metaproxy.xsd b/xml/schema/metaproxy.xsd index dfb47c9..1869052 100644 --- a/xml/schema/metaproxy.xsd +++ b/xml/schema/metaproxy.xsd @@ -403,9 +403,11 @@ + + -- 1.7.10.4