* Copyright (c) 1998-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-proxy.cpp,v 1.82 2004-01-07 21:29:26 adam Exp $
+ * $Id: yaz-proxy.cpp,v 1.85 2004-01-08 22:54:53 adam Exp $
*/
#include <assert.h>
return r;
}
-int Yaz_Proxy::send_to_srw_client_error(int srw_error)
+int Yaz_Proxy::send_to_srw_client_error(int srw_error, const char *add)
{
ODR o = odr_encode();
Z_SRW_PDU *srw_pdu = yaz_srw_get(o, Z_SRW_searchRetrieve_response);
srw_res->diagnostics = (Z_SRW_diagnostic *)
odr_malloc(o, sizeof(*srw_res->diagnostics));
srw_res->diagnostics[0].code = odr_intdup(o, srw_error);
- srw_res->diagnostics[0].details = 0;
+ srw_res->diagnostics[0].details = add ? odr_strdup(o, add) : 0;
return send_srw_response(srw_pdu);
}
Z_InitResponse *res = apdu->u.initResponse;
if (*res->result == 0)
{
- send_to_srw_client_error(3);
+ send_to_srw_client_error(3, 0);
}
else if (!m_s2z_search_apdu)
{
{
Z_SRW_searchRetrieveRequest *srw_req = srw_pdu->u.request;
+ // recordXPath unsupported.
+ if (srw_req->recordXPath)
+ {
+ send_to_srw_client_error(72, 0);
+ return;
+ }
+
// save stylesheet
if (srw_req->stylesheet)
m_s2z_stylesheet =
if (srw_req->query_type == Z_SRW_query_type_cql)
{
+ if (!srw_req->query.cql)
+ {
+ send_to_srw_client_error(7, "query");
+ return;
+ }
Z_External *ext = (Z_External *)
odr_malloc(m_s2z_odr_search, sizeof(*ext));
ext->direct_reference =
yaz_log(LOG_LOG, "%*s^\n", off+4, "");
yaz_log(LOG_LOG, "Bad PQF: %s (code %d)\n", pqf_msg, code);
- send_to_srw_client_error(10);
+ send_to_srw_client_error(10, 0);
return;
}
query->which = Z_Query_type_1;
}
else
{
- send_to_srw_client_error(11);
+ send_to_srw_client_error(7, "query");
return;
}
send_srw_explain();
return;
}
+ else
+ {
+ send_to_srw_client_error(4, 0);
+ }
}
int len = 0;
Z_GDU *p = z_get_HTTP_Response(odr_encode(), 400);