From: Adam Dickmeiss Date: Wed, 2 May 2007 11:51:54 +0000 (+0000) Subject: The negotiationModel bit is now set by default for init requests. X-Git-Tag: YAZ.3.0.0~5 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=5ee8b8431f852d06d1963134d38c1bb8fe6343fa The negotiationModel bit is now set by default for init requests. This will allow our servers to present the character set that they support - even in case of no negotiation information from the client side. --- diff --git a/client/client.c b/client/client.c index d8edfe1..dee6090 100644 --- a/client/client.c +++ b/client/client.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: client.c,v 1.334 2007-04-16 21:53:08 adam Exp $ + * $Id: client.c,v 1.335 2007-05-02 11:51:54 adam Exp $ */ /** \file client.c * \brief yaz-client program @@ -349,7 +349,8 @@ static void send_initRequest(const char* type_and_host) yaz_oi_APDU(apdu, &p); - if ((p0=yaz_oi_update(p, out, NULL, 0, 0))) { + if ((p0=yaz_oi_update(p, out, NULL, 0, 0))) + { ODR_MASK_SET(req->options, Z_Options_negotiationModel); p0->which = Z_OtherInfo_externallyDefinedInfo; @@ -360,7 +361,6 @@ static void send_initRequest(const char* type_and_host) negotiationCharsetRecords); } } - if (send_apdu(apdu)) printf("Sent initrequest.\n"); } @@ -453,7 +453,7 @@ static int process_initResponse(Z_InitResponse *res) Z_CharSetandLanguageNegotiation *p = yaz_get_charneg_record(res->otherInfo); - + if (p) { char *charset=NULL, *lang=NULL; @@ -462,18 +462,20 @@ static int process_initResponse(Z_InitResponse *res) yaz_get_response_charneg(session_mem, p, &charset, &lang, &selected); + printf("Accepted character set : %s\n", charset); + printf("Accepted code language : %s\n", lang ? lang : "none"); + printf("Accepted records in ...: %d\n", selected ); + if (outputCharset && negotiationCharset) { - odr_set_charset (out, charset, outputCharset); - odr_set_charset (in, outputCharset, charset); + printf("Converting between %s and %s\n", + outputCharset, negotiationCharset); + odr_set_charset (out, charset, outputCharset); + odr_set_charset (in, outputCharset, charset); } else { - odr_set_charset (out, 0, 0); - odr_set_charset (in, 0, 0); + odr_set_charset (out, 0, 0); + odr_set_charset (in, 0, 0); } - - printf("Accepted character set : %s\n", charset); - printf("Accepted code language : %s\n", lang ? lang : "none"); - printf("Accepted records in ...: %d\n", selected ); } } fflush (stdout); @@ -4765,6 +4767,7 @@ int main(int argc, char **argv) ODR_MASK_SET(&z3950_options, Z_Options_sort); ODR_MASK_SET(&z3950_options, Z_Options_extendedServices); ODR_MASK_SET(&z3950_options, Z_Options_delSet); + ODR_MASK_SET(&z3950_options, Z_Options_negotiationModel); while ((ret = options("k:c:q:a:b:m:v:p:u:t:Vxd:", argv, argc, &arg)) != -2) {