From 926357dcfb7a359cc7a23766460cef5fe21156ee Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 6 Sep 2006 09:35:39 +0000 Subject: [PATCH] For the generic frontend server, the maximum record size is used as maximum size of incoming packages (SRU + Z39.50). The value until was previously only used in Z39.50 Init negotiation and, later, in a session controlled sizes of records returned. This is controlled using -k option. It can be specified, per server, with element maximumrecordsize in YAZ' GFS XML config. --- NEWS | 6 ++++++ doc/gfs-virtual.xml | 14 ++++++++++++- etc/yazgfs.xml | 3 ++- src/seshigh.c | 18 +++++++---------- src/statserv.c | 55 +++++++++++++++++++++++++++++++-------------------- 5 files changed, 62 insertions(+), 34 deletions(-) diff --git a/NEWS b/NEWS index 536f12a..200dfc4 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +For the generic frontend server, the maximum record size is used as maximum +size of incoming packages (SRU + Z39.50). The value until was previously +only used in Z39.50 Init negotiation and, later, in a session controlled +sizes of records returned. This is controlled using -k option. It can be +specified, per server, with element maximumrecordsize in YAZ' GFS XML config. + --- 2.1.28 2006/09/04 TCP/IP comstack uses getaddrinfo now to resolve names. It should be IPV6 diff --git a/doc/gfs-virtual.xml b/doc/gfs-virtual.xml index b32589b..593e8bc 100644 --- a/doc/gfs-virtual.xml +++ b/doc/gfs-virtual.xml @@ -1,5 +1,5 @@ @@ -169,6 +169,18 @@ + + element maximumrecordsize (optional) + + + Specifies maximum record size/message size, in bytes. This + value also servers as maximum size of incoming + packages (for Record Updates etc). It's the same value as that + given by the -k option. + + + + diff --git a/etc/yazgfs.xml b/etc/yazgfs.xml index ad435c7..42f3857 100644 --- a/etc/yazgfs.xml +++ b/etc/yazgfs.xml @@ -1,4 +1,4 @@ - + @@ -9,6 +9,7 @@ pqf.properties xsl xsl/default.xsl + 2000000 diff --git a/src/seshigh.c b/src/seshigh.c index 9227158..5132309 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.97 2006-09-01 12:40:44 adam Exp $ + * $Id: seshigh.c,v 1.98 2006-09-06 09:35:41 adam Exp $ */ /** * \file seshigh.c @@ -519,9 +519,6 @@ static int srw_bend_init(association *assoc, Z_SRW_diagnostic **d, int *num, Z_S yaz_log(log_requestdetail, "srw_bend_init config=%s", cb->configname); assoc_init_reset(assoc); - assoc->maximumRecordSize = 3000000; - assoc->preferredMessageSize = 3000000; - if (sr->username) { Z_IdAuthentication *auth = odr_malloc(assoc->decode, sizeof(*auth)); @@ -2308,13 +2305,12 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb) } yaz_log(log_requestdetail, "Negotiated to v%d: %s", assoc->version, options); - assoc->maximumRecordSize = *req->maximumRecordSize; - if (cb && assoc->maximumRecordSize > cb->maxrecordsize) - assoc->maximumRecordSize = cb->maxrecordsize; - assoc->preferredMessageSize = *req->preferredMessageSize; - if (assoc->preferredMessageSize > assoc->maximumRecordSize) - assoc->preferredMessageSize = assoc->maximumRecordSize; + if (*req->maximumRecordSize < assoc->maximumRecordSize) + assoc->maximumRecordSize = *req->maximumRecordSize; + + if (*req->preferredMessageSize < assoc->preferredMessageSize) + assoc->preferredMessageSize = *req->preferredMessageSize; resp->preferredMessageSize = &assoc->preferredMessageSize; resp->maximumRecordSize = &assoc->maximumRecordSize; @@ -2327,7 +2323,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.97 $"); + version = odr_strdup(assoc->encode, "$Revision: 1.98 $"); if (strlen(version) > 10) /* check for unexpanded CVS strings */ version[strlen(version)-2] = '\0'; resp->implementationVersion = odr_prepend(assoc->encode, diff --git a/src/statserv.c b/src/statserv.c index 7d4af0b..bed22d0 100644 --- a/src/statserv.c +++ b/src/statserv.c @@ -5,7 +5,7 @@ * NT threaded server code by * Chas Woodfield, Fretwell Downing Informatics. * - * $Id: statserv.c,v 1.40 2006-07-07 13:02:21 marc Exp $ + * $Id: statserv.c,v 1.41 2006-09-06 09:35:42 adam Exp $ */ /** @@ -301,23 +301,30 @@ int control_association(association *assoc, const char *host, int force_open) assoc->server = gfs; assoc->last_control = &gfs->cb; statserv_setcontrol(&gfs->cb); + gfs_server_chdir(gfs); - yaz_log(YLOG_DEBUG, "server select: %s", gfs->cb.configname); - return 1; + break; } } - statserv_setcontrol(0); - assoc->last_control = 0; - yaz_log(YLOG_DEBUG, "server select: no match"); - return 0; + if (!gfs) + { + statserv_setcontrol(0); + assoc->last_control = 0; + return 0; + } } else { statserv_setcontrol(&control_block); assoc->last_control = &control_block; - yaz_log(YLOG_DEBUG, "server select: config=%s", control_block.configname); - return 1; } + yaz_log(YLOG_DEBUG, "server select: config=%s", + assoc->last_control->configname); + + assoc->maximumRecordSize = assoc->last_control->maxrecordsize; + assoc->preferredMessageSize = assoc->last_control->maxrecordsize; + cs_set_max_recv_bytes(assoc->client_link, assoc->maximumRecordSize); + return 1; } static void xml_config_read() @@ -360,6 +367,7 @@ static void xml_config_read() xmlNodePtr ptr; const char *listenref = 0; const char *id = 0; + struct gfs_server *gfs; for ( ; attr; attr = attr->next) if (!xmlStrcmp(attr->name, BAD_CAST "listenref") @@ -372,8 +380,8 @@ static void xml_config_read() else yaz_log(YLOG_WARN, "Unknown attribute '%s' for server", attr->name); - *gfsp = gfs_server_new(); - (*gfsp)->server_node_ptr = ptr_server; + gfs = *gfsp = gfs_server_new(); + gfs->server_node_ptr = ptr_server; if (listenref) { int id_no; @@ -381,7 +389,7 @@ static void xml_config_read() for (id_no = 1; gl; gl = gl->next, id_no++) if (gl->id && !strcmp(gl->id, listenref)) { - (*gfsp)->listen_ref = id_no; + gfs->listen_ref = id_no; break; } if (!gl) @@ -394,36 +402,41 @@ static void xml_config_read() continue; if (!strcmp((const char *) ptr->name, "host")) { - (*gfsp)->host = nmem_dup_xml_content(gfs_nmem, + gfs->host = nmem_dup_xml_content(gfs_nmem, ptr->children); } else if (!strcmp((const char *) ptr->name, "config")) { - strcpy((*gfsp)->cb.configname, + strcpy(gfs->cb.configname, nmem_dup_xml_content(gfs_nmem, ptr->children)); } else if (!strcmp((const char *) ptr->name, "cql2rpn")) { - (*gfsp)->cql_transform = cql_transform_open_fname( + gfs->cql_transform = cql_transform_open_fname( nmem_dup_xml_content(gfs_nmem, ptr->children) ); } else if (!strcmp((const char *) ptr->name, "directory")) { - (*gfsp)->directory = + gfs->directory = nmem_dup_xml_content(gfs_nmem, ptr->children); } else if (!strcmp((const char *) ptr->name, "docpath")) { - (*gfsp)->docpath = + gfs->docpath = nmem_dup_xml_content(gfs_nmem, ptr->children); } + else if (!strcmp((const char *) ptr->name, "maximumrecordsize")) + { + gfs->cb.maxrecordsize = atoi( + nmem_dup_xml_content(gfs_nmem, ptr->children)); + } else if (!strcmp((const char *) ptr->name, "stylesheet")) { char *s = nmem_dup_xml_content(gfs_nmem, ptr->children); - (*gfsp)->stylesheet = + gfs->stylesheet = nmem_malloc(gfs_nmem, strlen(s) + 2); - sprintf((*gfsp)->stylesheet, "/%s", s); + sprintf(gfs->stylesheet, "/%s", s); } else if (!strcmp((const char *) ptr->name, "explain")) { @@ -431,10 +444,10 @@ static void xml_config_read() } else if (!strcmp((const char *) ptr->name, "retrievalinfo")) { - if (yaz_retrieval_configure((*gfsp)->retrieval, ptr)) + if (yaz_retrieval_configure(gfs->retrieval, ptr)) { yaz_log(YLOG_FATAL, "%s in config %s", - yaz_retrieval_get_error((*gfsp)->retrieval), + yaz_retrieval_get_error(gfs->retrieval), control_block.xml_config); exit(1); } -- 1.7.10.4