- // TODO: make nice diagnostic return package
- package.session().close();
- return;
- }
-
- //build_sru_debug_package(package);
- build_sru_response(package, odr_en, soap,
- sru_pdu_res, charset, stylesheet);
- return;
-
-
-
-
-
-
-
-}
-
-
-bool yf::SRUtoZ3950::Impl::build_simple_explain(mp::Package &package,
- mp::odr &odr_en,
- Z_SRW_PDU *sru_pdu_res,
- Z_SRW_explainRequest
- const *er_req) const
-{
-
- // z3950'fy recordPacking
- int record_packing = Z_SRW_recordPacking_XML;
- if (er_req->recordPacking && 's' == *(er_req->recordPacking))
- record_packing = Z_SRW_recordPacking_string;
-
- // getting database info
- std::string database("Default");
- if (er_req->database)
- database = er_req->database;
-
- // building SRU explain record
- std::string explain_xml
- = mp_util::to_string(
- "<explain>\n"
- " <serverInfo protocol='SRU'>\n"
- " <host>")
- + package.origin().server_host()
- + mp_util::to_string("</host>\n"
- " <port>")
- + mp_util::to_string(package.origin().server_port())
- + mp_util::to_string("</port>\n"
- " <database>")
- + database
- + mp_util::to_string("</database>\n"
- " </serverInfo>\n"
- "</explain>\n");
-
-
- // preparing explain record insert
- Z_SRW_explainResponse *sru_res = sru_pdu_res->u.explain_response;
- //sru_res->record
- // = (Z_SRW_record *) odr_malloc(odr_en, sizeof(Z_SRW_record));
-
- // inserting one and only explain record
-
- sru_res->record.recordPosition = odr_intdup(odr_en, 1);
- sru_res->record.recordPacking = record_packing;
- sru_res->record.recordSchema = "http://explain.z3950.org/dtd/2.0/";
- sru_res->record.recordData_len = 1 + explain_xml.size();
- sru_res->record.recordData_buf
- = odr_strdupn(odr_en, (const char *)explain_xml.c_str(),
- 1 + explain_xml.size());
-
- return true;
-};
-
-
-bool yf::SRUtoZ3950::Impl::build_sru_debug_package(mp::Package &package) const
-{
- Z_GDU *zgdu_req = package.request().get();
- if (zgdu_req && zgdu_req->which == Z_GDU_HTTP_Request)
- {
- Z_HTTP_Request* http_req = zgdu_req->u.HTTP_Request;
- std::string content = debug_http(*http_req);
- int http_code = 400;
- http_response(package, content, http_code);
- return true;