From 509f0f1303d24df2dc6b26f36f17b55613c2bdb7 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 7 Jan 2004 21:29:26 +0000 Subject: [PATCH] Honor stylesheet --- include/yaz++/proxy.h | 3 ++- src/yaz-proxy.cpp | 21 +++++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/include/yaz++/proxy.h b/include/yaz++/proxy.h index fd955bd..66a453d 100644 --- a/include/yaz++/proxy.h +++ b/include/yaz++/proxy.h @@ -2,7 +2,7 @@ * Copyright (c) 1998-2004, Index Data. * See the file LICENSE for details. * - * $Id: proxy.h,v 1.30 2004-01-07 20:56:02 adam Exp $ + * $Id: proxy.h,v 1.31 2004-01-07 21:29:26 adam Exp $ */ #include @@ -254,6 +254,7 @@ class YAZ_EXPORT Yaz_Proxy : public Yaz_Z_Assoc { Z_APDU *m_s2z_init_apdu; Z_APDU *m_s2z_search_apdu; Z_APDU *m_s2z_present_apdu; + char *m_s2z_stylesheet; char *m_soap_ns; int send_to_srw_client_error(int error); int send_to_srw_client_ok(int hits, Z_Records *records, int start); diff --git a/src/yaz-proxy.cpp b/src/yaz-proxy.cpp index 1559a46..febff85 100644 --- a/src/yaz-proxy.cpp +++ b/src/yaz-proxy.cpp @@ -2,7 +2,7 @@ * Copyright (c) 1998-2004, Index Data. * See the file LICENSE for details. * - * $Id: yaz-proxy.cpp,v 1.81 2004-01-07 21:04:10 adam Exp $ + * $Id: yaz-proxy.cpp,v 1.82 2004-01-07 21:29:26 adam Exp $ */ #include @@ -107,6 +107,7 @@ Yaz_Proxy::Yaz_Proxy(IYaz_PDU_Observable *the_PDU_Observable, m_config = 0; m_marcxml_flag = 0; m_stylesheet_schema = 0; + m_s2z_stylesheet = 0; m_schema = 0; m_initRequest_apdu = 0; m_initRequest_mem = 0; @@ -744,7 +745,7 @@ int Yaz_Proxy::send_srw_response(Z_SRW_PDU *srw_pdu) soap_package->ns = m_soap_ns; z_soap_codec_enc_xsl(o, &soap_package, &hres->content_buf, &hres->content_len, - soap_handlers, 0, 0); + soap_handlers, 0, m_s2z_stylesheet); if (m_log_mask & PROXY_LOG_REQ_CLIENT) { yaz_log (LOG_LOG, "%sSending %s to client", m_session_str, @@ -1565,10 +1566,18 @@ void Yaz_Proxy::handle_incoming_HTTP(Z_HTTP_Request *hreq) m_s2z_init_apdu = 0; m_s2z_search_apdu = 0; m_s2z_present_apdu = 0; + + m_s2z_stylesheet = 0; + if (srw_pdu->which == Z_SRW_searchRetrieve_request) { Z_SRW_searchRetrieveRequest *srw_req = srw_pdu->u.request; + // save stylesheet + if (srw_req->stylesheet) + m_s2z_stylesheet = + odr_strdup(m_s2z_odr_init, srw_req->stylesheet); + // set packing for response records .. if (srw_req->recordPacking && !strcmp(srw_req->recordPacking, "xml")) @@ -1712,7 +1721,12 @@ void Yaz_Proxy::handle_incoming_HTTP(Z_HTTP_Request *hreq) else if (srw_pdu->which == Z_SRW_explain_request) { Z_SRW_explainRequest *srw_req = srw_pdu->u.explain_request; - + + // save stylesheet + if (srw_req->stylesheet) + m_s2z_stylesheet = + odr_strdup(m_s2z_odr_init, srw_req->stylesheet); + if (srw_req->recordPacking && !strcmp(srw_req->recordPacking, "xml")) m_s2z_packing = Z_SRW_recordPacking_XML; @@ -1721,7 +1735,6 @@ void Yaz_Proxy::handle_incoming_HTTP(Z_HTTP_Request *hreq) if (!m_client) { - yaz_log(LOG_LOG, "handle_incoming: initRequest"); m_s2z_init_apdu = zget_APDU(m_s2z_odr_init, Z_APDU_initRequest); -- 1.7.10.4