From 60b23781949540ad214a331fa335da10f42fae7f Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 9 Jul 2014 16:46:05 +0200 Subject: [PATCH] echoedSearchRetrieveRequest for explain as well YAZ-776 --- src/seshigh.c | 6 ++---- src/srw.c | 8 ++++++++ src/srwutil.c | 12 ++++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/seshigh.c b/src/seshigh.c index 4c9f4f6..eb99a79 100644 --- a/src/seshigh.c +++ b/src/seshigh.c @@ -1879,8 +1879,7 @@ static void process_http_request(association *assoc, request *req) } else if (sr->which == Z_SRW_explain_request) { - Z_SRW_PDU *res = yaz_srw_get_pdu(o, Z_SRW_explain_response, - sr->srw_version); + Z_SRW_PDU *res = yaz_srw_get_pdu_e(o, Z_SRW_explain_response, sr); stylesheet = sr->u.explain_request->stylesheet; if (num_diagnostic) { @@ -1894,8 +1893,7 @@ static void process_http_request(association *assoc, request *req) } else if (sr->which == Z_SRW_scan_request) { - Z_SRW_PDU *res = yaz_srw_get_pdu(o, Z_SRW_scan_response, - sr->srw_version); + Z_SRW_PDU *res = yaz_srw_get_pdu_e(o, Z_SRW_scan_response, sr); stylesheet = sr->u.scan_request->stylesheet; if (num_diagnostic) { diff --git a/src/srw.c b/src/srw.c index 431696b..f7f2107 100644 --- a/src/srw.c +++ b/src/srw.c @@ -1053,6 +1053,14 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, yaz_srw_record(o, ptr1, &res->record, &res->extra_record, client_data, version2); } + if ((*p)->extra_args) + { + xmlNode *p1 = + xmlNewChild(ptr, 0, BAD_CAST "echoedExplainRequest", 0); + Z_SRW_extra_arg *ea = (*p)->extra_args; + for (; ea; ea = ea->next) + add_xsd_string(p1, ea->name, ea->value); + } if (res->num_diagnostics) { xmlNodePtr rptr = xmlNewChild(ptr, 0, BAD_CAST "diagnostics", diff --git a/src/srwutil.c b/src/srwutil.c index ef27e45..0f6d71c 100644 --- a/src/srwutil.c +++ b/src/srwutil.c @@ -497,6 +497,8 @@ int yaz_sru_decode(Z_HTTP_Request *hreq, Z_SRW_PDU **srw_pdu, operation = "searchRetrieve"; else if (scanClause) operation = "scan"; + else + operation = "explain"; } version = yaz_negotiate_sru_version(version); @@ -786,6 +788,16 @@ Z_SRW_PDU *yaz_srw_get_pdu_e(ODR o, int which, Z_SRW_PDU *req) if (req->u.request->sort_type == Z_SRW_sort_type_sort) l = append_extra_arg(o, l, "sortKeys", req->u.request->sort.sortKeys); + l = append_extra_arg(o, l, "stylesheet", req->u.request->stylesheet); + + } + if (req->which == Z_SRW_explain_request && + which == Z_SRW_explain_response) + { + Z_SRW_extra_arg **l = &res->extra_args; + l = append_extra_arg(o, l, "version", req->srw_version); + l = append_extra_arg(o, l, "stylesheet", + req->u.explain_request->stylesheet); } return res; } -- 1.7.10.4