X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Ffilter_multi.cpp;h=53912ee7cebb2292f3452418139c5c3a852293c5;hb=c1d953eee6c00432493bc364da6284704ccd9cc2;hp=61d001c4b450059df723ecd27861a1948a13f90a;hpb=e6d572ef110d14fa55115021505b808620457bd3;p=metaproxy-moved-to-github.git diff --git a/src/filter_multi.cpp b/src/filter_multi.cpp index 61d001c..53912ee 100644 --- a/src/filter_multi.cpp +++ b/src/filter_multi.cpp @@ -1,5 +1,5 @@ /* This file is part of Metaproxy. - Copyright (C) 2005-2010 Index Data + Copyright (C) 2005-2011 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 @@ -417,6 +417,8 @@ void yf::Multi::Frontend::init(mp::Package &package, Z_GDU *gdu) mp::util::set_vhost_otherinfo(&init_apdu->u.initRequest->otherInfo, odr, vhost_one); + init_apdu->u.initRequest->idAuthentication = req->idAuthentication; + Z_InitRequest *req = init_apdu->u.initRequest; ODR_MASK_SET(req->options, Z_Options_search); @@ -461,8 +463,6 @@ void yf::Multi::Frontend::init(mp::Package &package, Z_GDU *gdu) bit = m_backend_list.erase(bit); continue; } - no_succeeded++; - Z_GDU *gdu = p->response().get(); if (gdu && gdu->which == Z_GDU_Z3950 && gdu->u.z3950->which == Z_APDU_initResponse) @@ -481,28 +481,30 @@ void yf::Multi::Frontend::init(mp::Package &package, Z_GDU *gdu) for (i = 0; i <= Z_ProtocolVersion_3; i++) if (!ODR_MASK_GET(b_resp->protocolVersion, i)) ODR_MASK_CLEAR(f_resp->protocolVersion, i); - // reject if any of the backends reject - if (!*b_resp->result) - *f_resp->result = 0; + if (*b_resp->result) + no_succeeded++; + else + no_failed++; } else - { - // if any target does not return init return that (close or - // similar ) - package.response() = p->response(); - return; - } + no_failed++; bit++; } if (m_p->m_hide_unavailable) { if (no_succeeded == 0) + { + *f_resp->result = 0; package.session().close(); + } } else { if (no_failed) + { + *f_resp->result = 0; package.session().close(); + } } package.response() = f_apdu; } @@ -766,6 +768,14 @@ void yf::Multi::Frontend::present(mp::Package &package, Z_APDU *apdu_req) f_resp->records = z_records_diag; *f_resp->presentStatus = Z_PresentStatus_failure; } + else if (number < 0 || (size_t) number > jobs.size()) + { + f_apdu = + odr.create_presentResponse( + apdu_req, + YAZ_BIB1_PRESENT_REQUEST_OUT_OF_RANGE, + 0); + } else { f_resp->records = (Z_Records *) odr_malloc(odr, sizeof(Z_Records));