X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;ds=sidebyside;f=src%2Ffilter_sru_to_z3950.cpp;h=93196e1f0f6442016f28d0bd2eb98985645bab9f;hb=dc0a7b40ef2cc8138c93e078dd8c34de64460ebe;hp=140b346e03f39616ef2b1a52036c6f8a5efe9c56;hpb=990c610a6a791fff480ba1053cea487901dd476c;p=metaproxy-moved-to-github.git diff --git a/src/filter_sru_to_z3950.cpp b/src/filter_sru_to_z3950.cpp index 140b346..93196e1 100644 --- a/src/filter_sru_to_z3950.cpp +++ b/src/filter_sru_to_z3950.cpp @@ -1,5 +1,5 @@ /* This file is part of Metaproxy. - Copyright (C) 2005-2011 Index Data + Copyright (C) 2005-2012 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 @@ -211,6 +211,7 @@ void yf::SRUtoZ3950::Impl::sru(mp::Package &package, Z_GDU *zgdu_req) return; } + bool enable_package_log = false; std::string zurl; Z_SRW_extra_arg *arg; @@ -223,7 +224,18 @@ void yf::SRUtoZ3950::Impl::sru(mp::Package &package, Z_GDU *zgdu_req) { package.origin().set_max_sockets(atoi(arg->value)); } - + else if (!strcmp(arg->name, "x-session-id")) + { + package.origin().set_custom_session(arg->value); + } + else if (!strcmp(arg->name, "x-log-enable")) + { + if (*arg->value == '1') + { + enable_package_log = true; + package.log_enable(); + } + } assert(sru_pdu_req); // filter acts as sink for SRU explain requests @@ -285,6 +297,24 @@ void yf::SRUtoZ3950::Impl::sru(mp::Package &package, Z_GDU *zgdu_req) YAZ_SRW_UNSUPP_OPERATION, "unknown"); } + if (enable_package_log) + { + std::string l; + package.log_reset(l); + if (l.length()) + { + mp::wrbuf w; + + wrbuf_puts(w, "\n"); + wrbuf_xmlputs(w, l.c_str()); + wrbuf_puts(w, ""); + + sru_pdu_res->extraResponseData_len = w.len(); + sru_pdu_res->extraResponseData_buf = + odr_strdup(odr_en, wrbuf_cstr(w)); + } + } + // build and send SRU response mp_util::build_sru_response(package, odr_en, soap, sru_pdu_res, charset, stylesheet);