X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=src%2Ffilter_virt_db.cpp;h=98ed55ac734bda8a3d4352169179ac4457efadb0;hb=c25266b4a1f4287390ca8be1f00ec960625e342b;hp=4fc928c227eb7eb59afd348362dfdd6763ccf20b;hpb=be83c640396e23420206a204eb78d353aedede05;p=metaproxy-moved-to-github.git diff --git a/src/filter_virt_db.cpp b/src/filter_virt_db.cpp index 4fc928c..98ed55a 100644 --- a/src/filter_virt_db.cpp +++ b/src/filter_virt_db.cpp @@ -1,4 +1,4 @@ -/* $Id: filter_virt_db.cpp,v 1.31 2006-01-17 16:45:49 adam Exp $ +/* $Id: filter_virt_db.cpp,v 1.33 2006-01-18 10:57:27 adam Exp $ Copyright (c) 2005, Index Data. %LICENSE% @@ -56,6 +56,7 @@ namespace yp2 { yp2::Session m_session; bool m_is_virtual; bool m_in_use; + yazpp_1::GDU m_init_gdu; std::list m_backend_list; std::map m_sets; @@ -173,16 +174,19 @@ yf::Virt_db::BackendPtr yf::Virt_db::Frontend::init_backend( Z_APDU *init_apdu = zget_APDU(odr, Z_APDU_initRequest); - std::list::const_iterator t_it = b->m_targets.begin(); - int cat = 1; - for (; t_it != b->m_targets.end(); t_it++, cat++) - { - yaz_oi_set_string_oidval(&init_apdu->u.initRequest->otherInfo, odr, - VAL_PROXY, cat, t_it->c_str()); - } - + yp2::util::set_vhost_otherinfo(&init_apdu->u.initRequest->otherInfo, odr, + b->m_targets); Z_InitRequest *req = init_apdu->u.initRequest; + // copy stuff from Frontend Init Request + Z_GDU *org_gdu = m_init_gdu.get(); + Z_InitRequest *org_init = org_gdu->u.z3950->u.initRequest; + + req->idAuthentication = org_init->idAuthentication; + req->implementationId = org_init->implementationId; + req->implementationName = org_init->implementationName; + req->implementationVersion = org_init->implementationVersion; + ODR_MASK_SET(req->options, Z_Options_search); ODR_MASK_SET(req->options, Z_Options_present); ODR_MASK_SET(req->options, Z_Options_namedResultSets); @@ -596,10 +600,12 @@ void yf::Virt_db::process(Package &package) const { Z_InitRequest *req = gdu->u.z3950->u.initRequest; - const char *vhost = - yaz_oi_get_string_oidval(&req->otherInfo, VAL_PROXY, 1, 0); - if (!vhost) + std::list vhosts; + yp2::util::get_vhost_otherinfo(&req->otherInfo, false, vhosts); + if (vhosts.size() == 0) { + f->m_init_gdu = gdu; + yp2::odr odr; Z_APDU *apdu = odr.create_initResponse(gdu->u.z3950, 0, 0); Z_InitResponse *resp = apdu->u.initResponse;