projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/yaz
[yaz-moved-to-github.git]
/
src
/
zoom-c.c
diff --git
a/src/zoom-c.c
b/src/zoom-c.c
index
d02f63a
..
dc1dc0c
100644
(file)
--- a/
src/zoom-c.c
+++ b/
src/zoom-c.c
@@
-406,6
+406,7
@@
ZOOM_API(ZOOM_connection)
c->odr_in = odr_createmem(ODR_DECODE);
c->odr_out = odr_createmem(ODR_ENCODE);
c->odr_in = odr_createmem(ODR_DECODE);
c->odr_out = odr_createmem(ODR_ENCODE);
+ c->odr_print = 0;
c->async = 0;
c->support_named_resultsets = 0;
c->async = 0;
c->support_named_resultsets = 0;
@@
-479,6
+480,11
@@
ZOOM_API(void)
set_ZOOM_error(c, ZOOM_ERROR_NONE, 0);
ZOOM_connection_remove_tasks(c);
set_ZOOM_error(c, ZOOM_ERROR_NONE, 0);
ZOOM_connection_remove_tasks(c);
+ if (c->odr_print)
+ {
+ odr_setprint(c->odr_print, 0); /* prevent destroy from fclose'ing */
+ odr_destroy(c->odr_print);
+ }
if (ZOOM_options_get_bool(c->options, "apdulog", 0))
{
c->odr_print = odr_createmem(ODR_PRINT);
if (ZOOM_options_get_bool(c->options, "apdulog", 0))
{
c->odr_print = odr_createmem(ODR_PRINT);
@@
-1629,12
+1635,19
@@
static zoom_ret ZOOM_connection_send_search(ZOOM_connection c)
yaz_iconv_t cd = yaz_iconv_open(cp, "UTF-8");
if (cd)
{
yaz_iconv_t cd = yaz_iconv_open(cp, "UTF-8");
if (cd)
{
+ int r;
search_req->query = yaz_copy_Z_Query(search_req->query,
c->odr_out);
search_req->query = yaz_copy_Z_Query(search_req->query,
c->odr_out);
- yaz_query_charset_convert_rpnquery(search_req->query->u.type_1,
- c->odr_out, cd);
+ r = yaz_query_charset_convert_rpnquery_check(
+ search_req->query->u.type_1,
+ c->odr_out, cd);
yaz_iconv_close(cd);
yaz_iconv_close(cd);
+ if (r)
+ { /* query could not be char converted */
+ set_ZOOM_error(c, ZOOM_ERROR_INVALID_QUERY, 0);
+ return zoom_complete;
+ }
}
}
}
}
}
}
@@
-1965,6
+1978,9
@@
static const char *return_record(ZOOM_record rec, int *len,
charset);
if (ret_buf)
return ret_buf;
charset);
if (ret_buf)
return ret_buf;
+ /* bad ISO2709. Return fail unless raw (ISO2709) is wanted */
+ if (marctype != YAZ_MARC_ISO2709)
+ return 0;
}
return return_string_record(rec, len,
(const char *) r->u.octet_aligned->buf,
}
return return_string_record(rec, len,
(const char *) r->u.octet_aligned->buf,
@@
-2144,14
+2160,15
@@
ZOOM_API(const char *)
{
return return_record(rec, len, npr, YAZ_MARC_ISO2709, charset);
}
{
return return_record(rec, len, npr, YAZ_MARC_ISO2709, charset);
}
- else if (!strcmp (type, "ext"))
+ else if (!strcmp(type, "ext"))
{
if (len) *len = -1;
return (const char *) npr->u.databaseRecord;
}
{
if (len) *len = -1;
return (const char *) npr->u.databaseRecord;
}
- else if (!strcmp (type, "opac"))
+ else if (!strcmp(type, "opac"))
{
{
- return return_record(rec, len, npr, YAZ_MARC_MARCXML, charset);
+ if (npr->u.databaseRecord->which == Z_External_OPAC)
+ return return_record(rec, len, npr, YAZ_MARC_MARCXML, charset);
}
return 0;
}
}
return 0;
}
@@
-3136,7
+3153,7
@@
static Z_ItemOrder *encode_item_order(ZOOM_package p)
req->u.esRequest->notToKeep->resultSetItem->resultSetId =
odr_strdup(p->odr_out, str);
req->u.esRequest->notToKeep->resultSetItem->item =
req->u.esRequest->notToKeep->resultSetItem->resultSetId =
odr_strdup(p->odr_out, str);
req->u.esRequest->notToKeep->resultSetItem->item =
- (int *) odr_malloc(p->odr_out, sizeof(int));
+ odr_intdup(p->odr_out, 0);
str = ZOOM_options_get(p->options, "itemorder-item");
*req->u.esRequest->notToKeep->resultSetItem->item =
str = ZOOM_options_get(p->options, "itemorder-item");
*req->u.esRequest->notToKeep->resultSetItem->item =
@@
-4070,6
+4087,8
@@
static void handle_http(ZOOM_connection c, Z_HTTP_Response *hres)
Z_SRW_PDU *sr = (Z_SRW_PDU*) soap_package->u.generic->p;
ZOOM_options_set(c->options, "sru_version", sr->srw_version);
Z_SRW_PDU *sr = (Z_SRW_PDU*) soap_package->u.generic->p;
ZOOM_options_set(c->options, "sru_version", sr->srw_version);
+ ZOOM_options_setl(c->options, "sru_extra_response_data",
+ sr->extraResponseData_buf, sr->extraResponseData_len);
if (sr->which == Z_SRW_searchRetrieve_response)
cret = handle_srw_response(c, sr->u.response);
else if (sr->which == Z_SRW_scan_response)
if (sr->which == Z_SRW_searchRetrieve_response)
cret = handle_srw_response(c, sr->u.response);
else if (sr->which == Z_SRW_scan_response)