X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Ffilter_multi.cpp;h=5c581e5a1e2e6cfa4475a14a113772d83f27dc21;hb=a752c3a98eb824cf13596f3ddf3cade68ce04c49;hp=b1452c33099c046d3a5472ef87f56e8e60ebe8e4;hpb=2495ef28534a85e3f425301c053a48de7f7a53e6;p=metaproxy-moved-to-github.git diff --git a/src/filter_multi.cpp b/src/filter_multi.cpp index b1452c3..5c581e5 100644 --- a/src/filter_multi.cpp +++ b/src/filter_multi.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 @@ -35,6 +35,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include #include +#include #include #include @@ -444,6 +445,13 @@ void yf::Multi::Frontend::init(mp::Package &package, Z_GDU *gdu) *breq->preferredMessageSize = *req->preferredMessageSize; *breq->maximumRecordSize = *req->maximumRecordSize; + + const char *peer_name = yaz_oi_get_string_oid( + &req->otherInfo, yaz_oid_userinfo_client_ip, 1, 0); + if (peer_name) + yaz_oi_set_string_oid(&breq->otherInfo, odr, + yaz_oid_userinfo_client_ip, 1, peer_name); + ODR_MASK_SET(breq->options, Z_Options_search); ODR_MASK_SET(breq->options, Z_Options_present); ODR_MASK_SET(breq->options, Z_Options_namedResultSets); @@ -683,7 +691,7 @@ void yf::Multi::Frontend::search(mp::Package &package, Z_APDU *apdu_req) close_p ? "true" : "false", m_p->m_hide_errors ? "true" : "false"); *f_resp->resultCount = result_set_size; - if (close_p && (no_successful == 0 || !m_p->m_hide_errors)) + if (close_p && (no_successful == 0 || !m_p->m_hide_unavailable)) { package.session().close(); package.response() = close_p->response(); @@ -957,15 +965,10 @@ Z_Entry *yf::Multi::ScanTermInfo::get_entry(ODR odr) t->byAttributes = 0; t->otherTermInfo = 0; t->globalOccurrences = odr_intdup(odr, m_count); - t->term = (Z_Term *) - odr_malloc(odr, sizeof(*t->term)); + t->term = (Z_Term *) odr_malloc(odr, sizeof(*t->term)); t->term->which = Z_Term_general; - Odr_oct *o; - t->term->u.general = o = (Odr_oct *)odr_malloc(odr, sizeof(Odr_oct)); - - o->len = o->size = m_norm_term.size(); - o->buf = (unsigned char *) odr_malloc(odr, o->len); - memcpy(o->buf, m_norm_term.c_str(), o->len); + t->term->u.general = odr_create_Odr_oct(odr, + m_norm_term.c_str(), m_norm_term.size()); return e; }