X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=server%2Fseshigh.c;h=90b1a7009e6bb6cf934e02dd507412fec0ed6bf1;hb=9287c96097c00d28310becb14ea3dd7cfb9f2ab0;hp=2be36c157574507016d5dcd0e4f2260bbab6aff9;hpb=f576c6403441fc35f85a3e57f9423ff07d052de1;p=yaz-moved-to-github.git diff --git a/server/seshigh.c b/server/seshigh.c index 2be36c1..90b1a70 100644 --- a/server/seshigh.c +++ b/server/seshigh.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2002, Index Data * See the file LICENSE for details. * - * $Id: seshigh.c,v 1.130 2002-06-18 21:30:39 adam Exp $ + * $Id: seshigh.c,v 1.132 2002-09-25 12:37:07 adam Exp $ */ /* @@ -46,6 +46,8 @@ #include #include #include +#include +#include #include @@ -105,7 +107,11 @@ association *create_association(IOCHAN channel, COMSTACK link) strcpy(filename, control_block->apdufile); if (!(anew->print = odr_createmem(ODR_PRINT))) return 0; - if (*control_block->apdufile != '-') + if (*control_block->apdufile == '@') + { + odr_setprint(anew->print, yaz_log_file()); + } + else if (*control_block->apdufile != '-') { strcpy(filename, control_block->apdufile); if (!control_block->dynamic) @@ -358,6 +364,8 @@ void ir_session(IOCHAN h, int event) iochan_clearflag(h, EVENT_OUTPUT|EVENT_INPUT); iochan_setflag(h, assoc->cs_get_mask); } + else + assoc->cs_put_mask = EVENT_OUTPUT; break; default: if (conn->io_pending & CS_WANT_WRITE) @@ -574,7 +582,8 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb) Z_APDU *apdu = zget_APDU(assoc->encode, Z_APDU_initResponse); Z_InitResponse *resp = apdu->u.initResponse; bend_initresult *binitres; - char options[100]; + + char options[140]; xfree (assoc->init); assoc->init = (bend_initrequest *) xmalloc (sizeof(*assoc->init)); @@ -602,6 +611,17 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb) assoc->init->bend_scan = NULL; assoc->init->bend_segment = NULL; assoc->init->bend_fetch = NULL; + assoc->init->charneg_request = NULL; + assoc->init->charneg_response = NULL; + assoc->init->decode = assoc->decode; + + if (ODR_MASK_GET(req->options, Z_Options_negotiationModel)) + { + Z_CharSetandLanguageNegotiation *negotiation = + yaz_get_charneg_record (req->otherInfo); + if (negotiation->which == Z_CharSetandLanguageNegotiation_proposal) + assoc->init->charneg_request = negotiation; + } assoc->init->peer_name = odr_strdup (assoc->encode, cs_addrstr(assoc->client_link)); @@ -665,13 +685,33 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb) if (ODR_MASK_GET(req->options, Z_Options_concurrentOperations)) { ODR_MASK_SET(resp->options, Z_Options_concurrentOperations); - strcat(options, " concurop"); + strcat(options, " concurrop"); } if (ODR_MASK_GET(req->options, Z_Options_sort) && assoc->init->bend_sort) { ODR_MASK_SET(resp->options, Z_Options_sort); strcat(options, " sort"); } + + if (ODR_MASK_GET(req->options, Z_Options_negotiationModel) + && assoc->init->charneg_response) + { + Z_OtherInformation **p; + Z_OtherInformationUnit *p0; + + yaz_oi_APDU(apdu, &p); + + if ((p0=yaz_oi_update(p, assoc->encode, NULL, 0, 0))) { + ODR_MASK_SET(resp->options, Z_Options_negotiationModel); + + p0->which = Z_OtherInfo_externallyDefinedInfo; + p0->information.externallyDefinedInfo = + assoc->init->charneg_response; + } + ODR_MASK_SET(resp->options, Z_Options_negotiationModel); + strcat(options, " negotiation"); + } + if (ODR_MASK_GET(req->protocolVersion, Z_ProtocolVersion_1)) { ODR_MASK_SET(resp->protocolVersion, Z_ProtocolVersion_1); @@ -687,6 +727,7 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb) ODR_MASK_SET(resp->protocolVersion, Z_ProtocolVersion_3); assoc->version = 3; } + yaz_log(LOG_LOG, "Negotiated to v%d: %s", assoc->version, options); assoc->maximumRecordSize = *req->maximumRecordSize; if (assoc->maximumRecordSize > control_block->maxrecordsize)