X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fzoom-sru.c;h=bf89a4494fc51265920510ddbda00337298a8ece;hp=0185e68b23e6fb400e826882b8296eae00ce8b3f;hb=4d1450cc691292cef5bcfdd41cefc030e4dabbf6;hpb=ea0ffea1d02fe623b4da5b7b8aa972aa9f32f071 diff --git a/src/zoom-sru.c b/src/zoom-sru.c index 0185e68..bf89a44 100644 --- a/src/zoom-sru.c +++ b/src/zoom-sru.c @@ -35,8 +35,7 @@ static zoom_ret send_srw(ZOOM_connection c, Z_SRW_PDU *sr) const char *database = ZOOM_options_get(c->options, "databaseName"); gdu = z_get_HTTP_Request_uri(c->odr_out, c->host_port, - database, - c->proxy ? 1 : 0); + database, c->proxy_mode); if (c->sru_mode == zoom_sru_get) { @@ -254,6 +253,7 @@ static zoom_ret handle_srw_response(ZOOM_connection c, Z_SRW_searchRetrieveResponse *res) { ZOOM_resultset resultset = 0; + int *start, *count; int i; NMEM nmem; ZOOM_Event event; @@ -266,6 +266,8 @@ static zoom_ret handle_srw_response(ZOOM_connection c, return zoom_complete; resultset = c->tasks->u.search.resultset; + start = &c->tasks->u.search.start; + count = &c->tasks->u.search.count; syntax = c->tasks->u.search.syntax; elementSetName = c->tasks->u.search.elementSetName; schema = c->tasks->u.search.schema; @@ -374,6 +376,10 @@ static zoom_ret handle_srw_response(ZOOM_connection c, schema, diag); } } + *count -= i; + if (*count < 0) + *count = 0; + *start += i; nmem = odr_extract_mem(c->odr_in); nmem_transfer(odr_getmem(resultset->odr), nmem); nmem_destroy(nmem); @@ -385,14 +391,14 @@ static zoom_ret handle_srw_response(ZOOM_connection c, #endif #if YAZ_HAVE_XML2 -static void handle_srw_scan_response(ZOOM_connection c, - Z_SRW_scanResponse *res) +static zoom_ret handle_srw_scan_response(ZOOM_connection c, + Z_SRW_scanResponse *res) { NMEM nmem = odr_extract_mem(c->odr_in); ZOOM_scanset scan; if (!c->tasks || c->tasks->which != ZOOM_TASK_SCAN) - return; + return zoom_complete; scan = c->tasks->u.scan.scan; if (res->num_diagnostics > 0) @@ -404,6 +410,7 @@ static void handle_srw_scan_response(ZOOM_connection c, ZOOM_options_set_int(scan->options, "number", res->num_terms); nmem_destroy(nmem); + return zoom_complete; } #endif @@ -428,7 +435,7 @@ int ZOOM_handle_sru(ZOOM_connection c, Z_HTTP_Response *hres, if (sr->which == Z_SRW_searchRetrieve_response) *cret = handle_srw_response(c, sr->u.response); else if (sr->which == Z_SRW_scan_response) - handle_srw_scan_response(c, sr->u.scan_response); + *cret = handle_srw_scan_response(c, sr->u.scan_response); } } else @@ -454,7 +461,7 @@ int ZOOM_handle_sru(ZOOM_connection c, Z_HTTP_Response *hres, if (sr->which == Z_SRW_searchRetrieve_response) *cret = handle_srw_response(c, sr->u.response); else if (sr->which == Z_SRW_scan_response) - handle_srw_scan_response(c, sr->u.scan_response); + *cret = handle_srw_scan_response(c, sr->u.scan_response); else ret = -1; }