X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fseshigh.c;h=bdfb499854f513bc8f12d6441f09048328134534;hb=4a9cbf62bc7a294f1782386997e09d2dd4ba9671;hp=aebcdc0173d403a856513502d806c562a239625c;hpb=6b76baf0fb5d0d437caedd8076f77f372d775758;p=yaz-moved-to-github.git diff --git a/src/seshigh.c b/src/seshigh.c index aebcdc0..bdfb499 100644 --- a/src/seshigh.c +++ b/src/seshigh.c @@ -377,7 +377,7 @@ void ir_session(IOCHAN h, int event) { if (assoc->state != ASSOC_UP) { - yaz_log(YLOG_DEBUG, "Final timeout - closing connection."); + yaz_log(log_session, "Timeout. Closing connection"); /* do we need to lod this at all */ cs_close(conn); destroy_association(assoc); @@ -385,8 +385,7 @@ void ir_session(IOCHAN h, int event) } else { - yaz_log(log_sessiondetail, - "Session idle too long. Sending close."); + yaz_log(log_sessiondetail, "Timeout. Sending Z39.50 Close"); do_close(assoc, Z_Close_lackOfActivity, 0); } return; @@ -848,9 +847,10 @@ static int ccl2pqf(ODR odr, const Odr_oct *ccl, CCL_bibset bibset, static void srw_bend_search(association *assoc, request *req, Z_SRW_PDU *sr, - Z_SRW_searchRetrieveResponse *srw_res, + Z_SRW_PDU *res, int *http_code) { + Z_SRW_searchRetrieveResponse *srw_res = res->u.response; int srw_error = 0; Z_External *ext; Z_SRW_searchRetrieveRequest *srw_req = sr->u.request; @@ -873,6 +873,8 @@ static void srw_bend_search(association *assoc, request *req, rr.partial_resultset = 0; rr.query = (Z_Query *) odr_malloc(assoc->decode, sizeof(*rr.query)); rr.query->u.type_1 = 0; + rr.extra_args = sr->extra_args; + rr.extra_response_data = 0; if (srw_req->query_type == Z_SRW_query_type_cql) { @@ -1094,6 +1096,11 @@ static void srw_bend_search(association *assoc, request *req, srw_res->records = 0; } } + if (rr.extra_response_data) + { + res->extraResponseData_buf = rr.extra_response_data; + res->extraResponseData_len = strlen(rr.extra_response_data); + } if (rr.estimated_hit_count || rr.partial_resultset) { yaz_add_srw_diagnostic( @@ -1691,6 +1698,7 @@ static void process_http_request(association *assoc, request *req) int num_diagnostic = 0; const char *host = z_HTTP_header_lookup(hreq->headers, "Host"); + yaz_log(log_request, "%s %s HTTP/%s", hreq->method, hreq->path, hreq->version); if (!control_association(assoc, host, 0)) { p = z_get_HTTP_Response(o, 404); @@ -1783,8 +1791,7 @@ static void process_http_request(association *assoc, request *req) } else { - srw_bend_search(assoc, req, sr, res->u.response, - &http_code); + srw_bend_search(assoc, req, sr, res, &http_code); } if (http_code == 200) soap_package->u.generic->p = res; @@ -2364,6 +2371,9 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb) binitres->errstring); *resp->result = 0; } + else + assoc->state = ASSOC_UP; + if (log_request) { if (!req->idAuthentication) @@ -2458,9 +2468,9 @@ static Z_NamePlusRecord *surrogatediagrec(association *assoc, return zget_surrogateDiagRec(assoc->encode, dbname, error, addinfo); } -static Z_Records *pack_records(association *a, char *setname, odr_int_t start, - odr_int_t *num, Z_RecordComposition *comp, - odr_int_t *next, odr_int_t *pres, +static Z_Records *pack_records(association *a, char *setname, Odr_int start, + Odr_int *num, Z_RecordComposition *comp, + Odr_int *next, Odr_int *pres, Z_ReferenceId *referenceId, Odr_oid *oid, int *errcode) { @@ -2625,6 +2635,8 @@ static Z_APDU *process_searchRequest(association *assoc, request *reqb, bsrr->srw_setnameIdleTime = 0; bsrr->estimated_hit_count = 0; bsrr->partial_resultset = 0; + bsrr->extra_args = 0; + bsrr->extra_response_data = 0; yaz_log (log_requestdetail, "ResultSet '%s'", req->resultSetName); if (req->databaseNames) @@ -2704,9 +2716,9 @@ static Z_APDU *response_searchRequest(association *assoc, request *reqb, Z_APDU *apdu = (Z_APDU *)odr_malloc(assoc->encode, sizeof(*apdu)); Z_SearchResponse *resp = (Z_SearchResponse *) odr_malloc(assoc->encode, sizeof(*resp)); - odr_int_t *nulint = odr_intdup(assoc->encode, 0); - odr_int_t *next = odr_intdup(assoc->encode, 0); - odr_int_t *none = odr_intdup(assoc->encode, Z_SearchResponse_none); + Odr_int *nulint = odr_intdup(assoc->encode, 0); + Odr_int *next = odr_intdup(assoc->encode, 0); + Odr_int *none = odr_intdup(assoc->encode, Z_SearchResponse_none); int returnedrecs = 0; apdu->which = Z_APDU_searchResponse; @@ -2733,7 +2745,7 @@ static Z_APDU *response_searchRequest(association *assoc, request *reqb, else { bool_t *sr = odr_booldup(assoc->encode, 1); - odr_int_t *toget = odr_intdup(assoc->encode, 0); + Odr_int *toget = odr_intdup(assoc->encode, 0); Z_RecordComposition comp, *compp = 0; yaz_log(log_requestdetail, "resultCount: " ODR_INT_PRINTF, bsrt->hits); @@ -2743,7 +2755,9 @@ static Z_APDU *response_searchRequest(association *assoc, request *reqb, comp.which = Z_RecordComp_simple; /* how many records does the user agent want, then? */ - if (bsrt->hits <= *req->smallSetUpperBound) + if (bsrt->hits < 0) + *toget = 0; + else if (bsrt->hits <= *req->smallSetUpperBound) { *toget = bsrt->hits; if ((comp.u.simple = req->smallSetElementSetNames)) @@ -2762,7 +2776,7 @@ static Z_APDU *response_searchRequest(association *assoc, request *reqb, if (*toget && !resp->records) { - odr_int_t *presst = odr_intdup(assoc->encode, 0); + Odr_int *presst = odr_intdup(assoc->encode, 0); /* Call bend_present if defined */ if (assoc->init->bend_present) { @@ -2872,8 +2886,8 @@ static Z_APDU *process_presentRequest(association *assoc, request *reqb, Z_PresentRequest *req = reqb->apdu_request->u.presentRequest; Z_APDU *apdu; Z_PresentResponse *resp; - odr_int_t *next; - odr_int_t *num; + Odr_int *next; + Odr_int *num; int errcode = 0; const char *errstring = 0; @@ -2966,8 +2980,8 @@ static Z_APDU *process_scanRequest(association *assoc, request *reqb, int *fd) Z_APDU *apdu = (Z_APDU *)odr_malloc(assoc->encode, sizeof(*apdu)); Z_ScanResponse *res = (Z_ScanResponse *) odr_malloc(assoc->encode, sizeof(*res)); - odr_int_t *scanStatus = odr_intdup(assoc->encode, Z_Scan_failure); - odr_int_t *numberOfEntriesReturned = odr_intdup(assoc->encode, 0); + Odr_int *scanStatus = odr_intdup(assoc->encode, Z_Scan_failure); + Odr_int *numberOfEntriesReturned = odr_intdup(assoc->encode, 0); Z_ListEntries *ents = (Z_ListEntries *) odr_malloc(assoc->encode, sizeof(*ents)); Z_DiagRecs *diagrecs_p = NULL; @@ -3268,7 +3282,7 @@ static Z_APDU *process_deleteRequest(association *assoc, request *reqb, bdrr->statuses = 0; if (bdrr->num_setnames > 0) { - bdrr->statuses = (odr_int_t*) + bdrr->statuses = (Odr_int*) odr_malloc(assoc->encode, sizeof(*bdrr->statuses) * bdrr->num_setnames); for (i = 0; i < bdrr->num_setnames; i++)