projects
/
metaproxy-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Depend on yaz++ 1.0.3
[metaproxy-moved-to-github.git]
/
src
/
filter_sru_to_z3950.cpp
diff --git
a/src/filter_sru_to_z3950.cpp
b/src/filter_sru_to_z3950.cpp
index
9cb97bb
..
30be4da
100644
(file)
--- a/
src/filter_sru_to_z3950.cpp
+++ b/
src/filter_sru_to_z3950.cpp
@@
-1,4
+1,4
@@
-/* $Id: filter_sru_to_z3950.cpp,v 1.31 2007-03-20 07:05:10 adam Exp $
+/* $Id: filter_sru_to_z3950.cpp,v 1.33 2007-04-13 09:57:51 adam Exp $
Copyright (c) 2005-2007, Index Data.
See the LICENSE file for details
Copyright (c) 2005-2007, Index Data.
See the LICENSE file for details
@@
-16,6
+16,7
@@
#include <yaz/z-core.h>
#include <yaz/srw.h>
#include <yaz/pquery.h>
#include <yaz/z-core.h>
#include <yaz/srw.h>
#include <yaz/pquery.h>
+#include <yaz/oid_db.h>
#include <boost/thread/mutex.hpp>
#include <boost/thread/mutex.hpp>
@@
-176,7
+177,7
@@
void yf::SRUtoZ3950::Impl::process(mp::Package &package)
// filter acts as sink for non-valid SRU requests
if (! (sru_pdu_req = mp_util::decode_sru_request(package, odr_de, odr_en,
// filter acts as sink for non-valid SRU requests
if (! (sru_pdu_req = mp_util::decode_sru_request(package, odr_de, odr_en,
- sru_pdu_res, soap,
+ sru_pdu_res, &soap,
charset, stylesheet)))
{
if (soap)
charset, stylesheet)))
{
if (soap)
@@
-205,16
+206,11
@@
void yf::SRUtoZ3950::Impl::process(mp::Package &package)
// sruinfo, er_req);
mp_util::build_sru_explain(package, odr_en, sru_pdu_res,
sruinfo, explainnode, er_req);
// sruinfo, er_req);
mp_util::build_sru_explain(package, odr_en, sru_pdu_res,
sruinfo, explainnode, er_req);
- mp_util::build_sru_response(package, odr_en, soap,
- sru_pdu_res, charset, stylesheet);
- return;
}
}
-
- // searchRetrieve
else if (sru_pdu_req
&& sru_pdu_req->which == Z_SRW_searchRetrieve_request
&& sru_pdu_req->u.request)
else if (sru_pdu_req
&& sru_pdu_req->which == Z_SRW_searchRetrieve_request
&& sru_pdu_req->u.request)
- {
+ { // searchRetrieve
Z_SRW_searchRetrieveRequest *sr_req = sru_pdu_req->u.request;
sru_pdu_res = yaz_srw_get(odr_en, Z_SRW_searchRetrieve_response);
Z_SRW_searchRetrieveRequest *sr_req = sru_pdu_req->u.request;
sru_pdu_res = yaz_srw_get(odr_en, Z_SRW_searchRetrieve_response);
@@
-277,7
+273,6
@@
void yf::SRUtoZ3950::Impl::process(mp::Package &package)
// build and send SRU response
mp_util::build_sru_response(package, odr_en, soap,
sru_pdu_res, charset, stylesheet);
// build and send SRU response
mp_util::build_sru_response(package, odr_en, soap,
sru_pdu_res, charset, stylesheet);
- return;
}
}
@@
-367,12
+362,11
@@
yf::SRUtoZ3950::Impl::z3950_close_request(mp::Package &package) const
return false;
}
return false;
}
-bool
-yf::SRUtoZ3950::Impl::z3950_search_request(mp::Package &package,
- mp::odr &odr_en,
- Z_SRW_PDU *sru_pdu_res,
- Z_SRW_searchRetrieveRequest
- const *sr_req) const
+bool yf::SRUtoZ3950::Impl::z3950_search_request(mp::Package &package,
+ mp::odr &odr_en,
+ Z_SRW_PDU *sru_pdu_res,
+ Z_SRW_searchRetrieveRequest
+ const *sr_req) const
{
assert(sru_pdu_res->u.response);
{
assert(sru_pdu_res->u.response);
@@
-573,8
+567,9
@@
yf::SRUtoZ3950::Impl::z3950_present_request(mp::Package &package,
record_packing = Z_SRW_recordPacking_string;
// RecordSyntax will always be XML
record_packing = Z_SRW_recordPacking_string;
// RecordSyntax will always be XML
- (apdu->u.presentRequest->preferredRecordSyntax)
- = yaz_oidval_to_z3950oid (odr_en, CLASS_RECSYN, VAL_TEXT_XML);
+ apdu->u.presentRequest->preferredRecordSyntax
+ = yaz_string_to_oid_odr(yaz_oid_std(), CLASS_RECSYN, OID_STR_XML,
+ odr_en);
// z3950'fy record schema
if (sr_req->recordSchema)
// z3950'fy record schema
if (sr_req->recordSchema)
@@
-669,9
+664,11
@@
yf::SRUtoZ3950::Impl::z3950_present_request(mp::Package &package,
else
{
Z_External *r = npr->u.databaseRecord;
else
{
Z_External *r = npr->u.databaseRecord;
- oident *ent = oid_getentbyoid(r->direct_reference);
- if (r->which == Z_External_octet
- && ent->value == VAL_TEXT_XML)
+ const int *xml_oid = yaz_string_to_oid(yaz_oid_std(),
+ CLASS_RECSYN,
+ OID_STR_XML);
+ if (xml_oid && r->direct_reference
+ && !oid_oidcmp(r->direct_reference, xml_oid))
{
sru_res->records[i].recordSchema = "dc";
sru_res->records[i].recordData_buf
{
sru_res->records[i].recordSchema = "dc";
sru_res->records[i].recordData_buf