- // getting database info
- std::string database("Default");
- if (er_req && er_req->database)
- database = er_req->database;
-
- // getting host and port info
- std::string host = package.origin().listen_host();
- std::string port = mp_util::to_string(package.origin().listen_port());
+ // building SRU explain record
+ std::string explain_xml;
+
+ if (explain == 0){
+ explain_xml
+ = mp_util::to_string(
+ "<explain xmlns=\"" + xmlns_explain + "\">\n"
+ " <serverInfo protocol='SRU'>\n"
+ " <host>")
+ + sruinfo.host
+ + mp_util::to_string("</host>\n"
+ " <port>")
+ + sruinfo.port
+ + mp_util::to_string("</port>\n"
+ " <database>")
+ + sruinfo.database
+ + mp_util::to_string("</database>\n"
+ " </serverInfo>\n"
+ "</explain>\n");
+ }
+ else {
+ // make new XML DOC with given explain node
+ xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0");
+ xmlDocSetRootElement(doc, (xmlNode*)explain);