From: Adam Dickmeiss Date: Tue, 30 Jun 2009 09:50:33 +0000 (+0200) Subject: Allow control of pass-through of vhosts for virt_db X-Git-Tag: v1.0.18~6 X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=commitdiff_plain;h=779166ef71fd082438f80b1e6af6dbaeb4310eab;hp=204943044b0a58cb977e174eb62133c343c0731b;p=metaproxy-moved-to-github.git 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. --- 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 @@ + +