X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fzoom-c.c;h=65d14ab93bfe9d94e107abdc6a3fc35f2c6df030;hb=f6379872ace49628473c47d23b29e9f46b5afbe4;hp=b5d867824fe1a72e422e73694f603847c5dea3c4;hpb=1648788aab97d7f8ccb78037aee89b0039c90041;p=yaz-moved-to-github.git diff --git a/src/zoom-c.c b/src/zoom-c.c index b5d8678..65d14ab 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2006, Index Data ApS * See the file LICENSE for details. * - * $Id: zoom-c.c,v 1.96 2006-11-06 14:49:32 marc Exp $ + * $Id: zoom-c.c,v 1.101 2006-12-06 11:12:14 mike Exp $ */ /** * \file zoom-c.c @@ -453,9 +453,6 @@ ZOOM_API(void) else c->lang = 0; - val = ZOOM_options_get(c->options, "sru"); - c->sru_mode = get_sru_mode_from_string(val); - xfree(c->host_port); if (portnum) { @@ -497,6 +494,9 @@ ZOOM_API(void) } } + val = ZOOM_options_get(c->options, "sru"); + c->sru_mode = get_sru_mode_from_string(val); + ZOOM_options_set(c->options, "host", c->host_port); val = ZOOM_options_get(c->options, "cookie"); @@ -1276,7 +1276,7 @@ static zoom_ret ZOOM_connection_send_init(ZOOM_connection c) odr_prepend(c->odr_out, "ZOOM-C", ireq->implementationName)); - version = odr_strdup(c->odr_out, "$Revision: 1.96 $"); + version = odr_strdup(c->odr_out, "$Revision: 1.101 $"); if (strlen(version) > 10) /* check for unexpanded CVS strings */ version[strlen(version)-2] = '\0'; ireq->implementationVersion = @@ -2508,15 +2508,6 @@ static zoom_ret send_present(ZOOM_connection c) count = &c->tasks->u.retrieve.count; syntax = c->tasks->u.retrieve.syntax; elementSetName = c->tasks->u.retrieve.elementSetName; - - if (*start >= resultset->size) - { - yaz_log(log_details, "%p send_present start=%d >= size=%d", - c, *start, resultset->size); - return zoom_complete; - } - if (*start + *count > resultset->size) - *count = resultset->size - *start; break; default: return zoom_complete; @@ -2524,10 +2515,13 @@ static zoom_ret send_present(ZOOM_connection c) yaz_log(log_details, "%p send_present start=%d count=%d", c, *start, *count); + if (*start < 0 || *count < 0 || *start + *count > resultset->size) + { + set_dset_error(c, YAZ_BIB1_PRESENT_REQUEST_OUT_OF_RANGE, "Bib-1", + "", 0); + } if (c->error) /* don't continue on error */ return zoom_complete; - if (*start < 0) - return zoom_complete; yaz_log(log_details, "send_present resultset=%p start=%d count=%d", resultset, *start, *count); @@ -3312,8 +3306,6 @@ static int ZOOM_connection_exec_task(ZOOM_connection c) c, task->which, task->running); if (c->error != ZOOM_ERROR_NONE) { - yaz_log(YLOG_LOG, "%p ZOOM_connection_exec_task " - "removing tasks because of error = %d", c, c->error); yaz_log(log_details, "%p ZOOM_connection_exec_task " "removing tasks because of error = %d", c, c->error); ZOOM_connection_remove_tasks(c); @@ -3444,6 +3436,16 @@ static void interpret_otherinformation_field(ZOOM_connection c, } } + +static void set_init_option(const char *name, void *clientData) { + ZOOM_connection c = clientData; + char buf[80]; + + sprintf(buf, "init_opt_%.70s", name); + ZOOM_connection_option_set(c, buf, "1"); +} + + static void recv_apdu(ZOOM_connection c, Z_APDU *apdu) { Z_InitResponse *initrs; @@ -3474,6 +3476,10 @@ static void recv_apdu(ZOOM_connection c, Z_APDU *apdu) ZOOM_connection_option_set(c, "targetImplementationVersion", initrs->implementationVersion ? initrs->implementationVersion : ""); + + /* Make initrs->options available as ZOOM-level options */ + yaz_init_opt_decode(initrs->options, set_init_option, (void*) c); + if (!*initrs->result) { Z_External *uif = initrs->userInformationField; @@ -4188,7 +4194,14 @@ ZOOM_API(int) return 0; #if HAVE_SYS_POLL_H - r = poll(pollfds, nfds, (timeout == -1 ? -1 : timeout * 1000)); + while ((r = poll(pollfds, nfds, + (timeout == -1 ? -1 : timeout * 1000))) < 0 + && errno == EINTR) + { + ; + } + if (r < 0) + yaz_log(YLOG_WARN|YLOG_ERRNO, "ZOOM_event: poll"); for (i = 0; i