X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Ffilter_z3950_client.cpp;h=dd16ffe4a0557138700e71156a4f771f1c8cedbc;hb=8b5b1897bd1223b6c8608685e0cceb82b47e5aed;hp=eef55ad904254e45cfdfc839bc588aab9ef93d7a;hpb=4af83af2939aae2ddf5d9fb018663c1cf0f424a1;p=metaproxy-moved-to-github.git diff --git a/src/filter_z3950_client.cpp b/src/filter_z3950_client.cpp index eef55ad..dd16ffe 100644 --- a/src/filter_z3950_client.cpp +++ b/src/filter_z3950_client.cpp @@ -86,6 +86,7 @@ namespace metaproxy_1 { int m_max_sockets; bool m_force_close; bool m_client_ip; + bool m_bind_host; std::string m_charset; std::string m_default_target; std::string m_force_target; @@ -301,6 +302,7 @@ yf::Z3950Client::Z3950Client() : m_p(new yf::Z3950Client::Rep) m_p->m_max_sockets = 0; m_p->m_force_close = false; m_p->m_client_ip = false; + m_p->m_bind_host = false; } yf::Z3950Client::~Z3950Client() { @@ -527,7 +529,18 @@ void yf::Z3950Client::Rep::send_and_receive(Package &package, c->m_waiting = true; if (!c->m_connected) { - if (c->client(c->m_host.c_str())) + std::string host(c->m_host); + + if (m_bind_host) + { + std::string bind_host = package.origin().get_bind_address(); + if (bind_host.length()) + { + host.append(" "); + host.append(bind_host); + } + } + if (c->client(host.c_str())) { mp::odr odr; package.response() = @@ -664,6 +677,10 @@ void yf::Z3950Client::configure(const xmlNode *ptr, bool test_only, { m_p->m_charset = mp::xml::get_text(ptr); } + else if (!strcmp((const char *) ptr->name, "bind_host")) + { + m_p->m_bind_host = mp::xml::get_bool(ptr, 0); + } else { throw mp::filter::FilterException("Bad element "