X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Ffilter_sru_to_z3950.cpp;h=2b62986299271a2e3f38014297f23668d58f6d2d;hb=9a318d33c4c99ee4158d39e3a62988af0229d7cf;hp=8c18dabc126a1ec6af60c910fb5473b0a8293c71;hpb=1cdd720a9a3ba872aa092c80b28413d8b2579eed;p=metaproxy-moved-to-github.git
diff --git a/src/filter_sru_to_z3950.cpp b/src/filter_sru_to_z3950.cpp
index 8c18dab..2b62986 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;
@@ -230,7 +231,10 @@ void yf::SRUtoZ3950::Impl::sru(mp::Package &package, Z_GDU *zgdu_req)
else if (!strcmp(arg->name, "x-log-enable"))
{
if (*arg->value == '1')
+ {
+ enable_package_log = true;
package.log_enable();
+ }
}
assert(sru_pdu_req);
@@ -293,20 +297,23 @@ void yf::SRUtoZ3950::Impl::sru(mp::Package &package, Z_GDU *zgdu_req)
YAZ_SRW_UNSUPP_OPERATION, "unknown");
}
-
- std::string l;
- package.log_reset(l);
- if (l.length())
+ if (enable_package_log)
{
- WRBUF w = wrbuf_alloc();
-
- wrbuf_puts(w, "\n");
- wrbuf_xmlputs(w, l.c_str());
- wrbuf_puts(w, "");
-
- sru_pdu_res->extraResponseData_len = wrbuf_len(w);
- sru_pdu_res->extraResponseData_buf = odr_strdup(odr_en, wrbuf_cstr(w));
- wrbuf_destroy(w);
+ std::string l;
+ package.log_reset(l);
+ if (l.length())
+ {
+ WRBUF w = wrbuf_alloc();
+
+ wrbuf_puts(w, "\n");
+ wrbuf_xmlputs(w, l.c_str());
+ wrbuf_puts(w, "");
+
+ sru_pdu_res->extraResponseData_len = wrbuf_len(w);
+ sru_pdu_res->extraResponseData_buf =
+ odr_strdup(odr_en, wrbuf_cstr(w));
+ wrbuf_destroy(w);
+ }
}
// build and send SRU response