X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fseshigh.c;h=2a3fc2fb7eb8e3102d00205e63780461d20d6bf8;hb=b925ea17d6f146a28d745b0d34e9eec6eafda21f;hp=e2b2afaffd5a0a3d603af9dfb0345954959f78c7;hpb=d1ff65fe4a7472a58a182d922c4a9729f0e17f9f;p=yaz-moved-to-github.git diff --git a/src/seshigh.c b/src/seshigh.c index e2b2afa..2a3fc2f 100644 --- a/src/seshigh.c +++ b/src/seshigh.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: seshigh.c,v 1.94 2006-07-07 13:02:21 marc Exp $ + * $Id: seshigh.c,v 1.96 2006-08-24 13:25:45 adam Exp $ */ /** * \file seshigh.c @@ -340,7 +340,7 @@ void ir_session(IOCHAN h, int event) } assoc->cs_get_mask = EVENT_INPUT; if ((res = cs_get(conn, &assoc->input_buffer, - &assoc->input_buffer_len)) <= 0) + &assoc->input_buffer_len)) == 0) { yaz_log(log_sessiondetail, "Connection closed by client"); cs_close(conn); @@ -348,6 +348,15 @@ void ir_session(IOCHAN h, int event) iochan_destroy(h); return; } + else if (res < 0) + { + yaz_log(log_session, "Connection error: %s", + cs_errmsg(cs_errno(conn))); + req = request_get(&assoc->incoming); /* get a new request */ + do_close_req(assoc, Z_Close_protocolError, + "Incoming package too large", req); + return; + } else if (res == 1) /* incomplete read - wait for more */ { if (conn->io_pending & CS_WANT_WRITE) @@ -378,7 +387,7 @@ void ir_session(IOCHAN h, int event) yaz_log(YLOG_WARN, "PDU dump:"); odr_dumpBER(yaz_log_file(), assoc->input_buffer, res); request_release(req); - do_close(assoc, Z_Close_protocolError,"Malformed package"); + do_close(assoc, Z_Close_protocolError, "Malformed package"); } else { @@ -690,7 +699,8 @@ static int retrieve_fetch(association *assoc, bend_fetch_rr *rr) static int srw_bend_fetch(association *assoc, int pos, Z_SRW_searchRetrieveRequest *srw_req, - Z_SRW_record *record) + Z_SRW_record *record, + const char **addinfo) { bend_fetch_rr rr; ODR o = assoc->encode; @@ -789,7 +799,12 @@ static int srw_bend_fetch(association *assoc, int pos, else record->recordSchema = 0; } - return rr.errcode; + if (rr.errcode) + { + *addinfo = rr.errstring; + return rr.errcode; + } + return 0; } static int cql2pqf(ODR odr, const char *cql, cql_transform_t ct, @@ -1082,20 +1097,22 @@ static void srw_bend_search(association *assoc, request *req, for (i = 0; irecords[j].recordPacking = packing; srw_res->records[j].recordData_buf = 0; srw_res->extra_records[j] = 0; yaz_log(YLOG_DEBUG, "srw_bend_fetch %d", i+start); errcode = srw_bend_fetch(assoc, i+start, srw_req, - srw_res->records + j); + srw_res->records + j, + &addinfo); if (errcode) { yaz_add_srw_diagnostic(assoc->encode, &srw_res->diagnostics, &srw_res->num_diagnostics, yaz_diag_bib1_to_srw (errcode), - rr.errstring); + addinfo); break; } @@ -2309,7 +2326,7 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb) assoc->init->implementation_name, odr_prepend(assoc->encode, "GFS", resp->implementationName)); - version = odr_strdup(assoc->encode, "$Revision: 1.94 $"); + version = odr_strdup(assoc->encode, "$Revision: 1.96 $"); if (strlen(version) > 10) /* check for unexpanded CVS strings */ version[strlen(version)-2] = '\0'; resp->implementationVersion = odr_prepend(assoc->encode,