From: Adam Dickmeiss Date: Thu, 23 Sep 2010 12:37:07 +0000 (+0200) Subject: GFS: no-keepalive option, mostly for testing X-Git-Tag: v4.1.0~3 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=f0d23836907782b75c45f9572ff0df25561b2cf8 GFS: no-keepalive option, mostly for testing The no-keepalive option is enabled for GFS by supplying option -K. --- diff --git a/doc/gfs-options.xml b/doc/gfs-options.xml index 9af6f0e..c3ed444 100644 --- a/doc/gfs-options.xml +++ b/doc/gfs-options.xml @@ -154,6 +154,15 @@ + -K + + Forces no-keepalive for HTTP sessions. By default GFS will keep + sessions alive for HTTP 1.1 sessions (as defined by the standard). + Using this option will force GFS to close the connection for each + operation. + + + -r size diff --git a/doc/gfs-synopsis.xml b/doc/gfs-synopsis.xml index 81266c6..babc5e3 100644 --- a/doc/gfs-synopsis.xml +++ b/doc/gfs-synopsis.xml @@ -17,6 +17,7 @@ + diff --git a/doc/yaz-ztest-man.xml b/doc/yaz-ztest-man.xml index 14f743c..4707a97 100644 --- a/doc/yaz-ztest-man.xml +++ b/doc/yaz-ztest-man.xml @@ -24,7 +24,7 @@ yaz-ztest - Z39.50 Test Server + Z39.50/SRU Test Server @@ -32,9 +32,9 @@ DESCRIPTION - yaz-ztest is a Z39.50 test server that uses - the YAZ generic frontend server API. - The server acts as a real Z39.50 server but does not use a database. + yaz-ztest is a Z39.50/SRU test server that uses + the YAZ generic frontend server (GFS) API. + The server acts as a real Z39.50/SRU server but does not use a database. It returns a random hit count and returns a subset of a few built-in records. diff --git a/include/yaz/backend.h b/include/yaz/backend.h index c781fa3..5c04a60 100644 --- a/include/yaz/backend.h +++ b/include/yaz/backend.h @@ -358,6 +358,7 @@ typedef struct statserv_options_block int background; /**< auto daemon */ char cert_fname[128]; /**< SSL certificate fname */ char xml_config[128]; /**< XML config filename */ + int keepalive; /**< keep alive if HTTP 1.1 (default: 1) */ } statserv_options_block; YAZ_EXPORT int statserv_main( diff --git a/src/seshigh.c b/src/seshigh.c index 48e0a4b..378b130 100644 --- a/src/seshigh.c +++ b/src/seshigh.c @@ -1907,7 +1907,7 @@ static void process_http_request(association *assoc, request *req) keepalive = 1; hres->version = "1.1"; } - if (!keepalive) + if (!keepalive || !assoc->last_control->keepalive) { z_HTTP_header_add(o, &hres->headers, "Connection", "close"); assoc->state = ASSOC_DEAD; diff --git a/src/statserv.c b/src/statserv.c index 4def68a..d340a17 100644 --- a/src/statserv.c +++ b/src/statserv.c @@ -117,7 +117,8 @@ statserv_options_block control_block = { "", /* PID fname */ 0, /* background daemon */ "", /* SSL certificate filename */ - "" /* XML config filename */ + "", /* XML config filename */ + 1 /* keepalive */ }; static int max_sessions = 0; @@ -1259,7 +1260,7 @@ int check_options(int argc, char **argv) get_logbits(1); - while ((ret = options("1a:iszSTl:v:u:c:w:t:k:d:A:p:DC:f:m:r:", + while ((ret = options("1a:iszSTl:v:u:c:w:t:k:Kd:A:p:DC:f:m:r:", argv, argc, &arg)) != -2) { switch (ret) @@ -1337,6 +1338,9 @@ int check_options(int argc, char **argv) } control_block.maxrecordsize = r * 1024; break; + case 'K': + control_block.keepalive = 0; + break; case 'i': control_block.inetd = 1; break;