From: Adam Dickmeiss Date: Wed, 18 Apr 2012 11:57:31 +0000 (+0200) Subject: Merge branch 'master' into graceful_stop X-Git-Tag: v1.3.34~14 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=5b13052f4b5e568e3511d87c2e20c5332fc7db91;hp=15ea05a9ad38b8f63868845eff0ebb62c3d8b0a1;p=metaproxy-moved-to-github.git Merge branch 'master' into graceful_stop --- diff --git a/IDMETA b/IDMETA index 7011884..4743175 100644 --- a/IDMETA +++ b/IDMETA @@ -1,3 +1,3 @@ DEBIAN_DIST="wheezy squeeze lenny" UBUNTU_DIST="oneiric natty maverick lucid" -VERSION=1.3.28 +VERSION=1.3.29 diff --git a/NEWS b/NEWS index f0beb08..d20a76c 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,18 @@ +--- 1.3.29 2012/04/18 + +zoom: may read cf-proxy's config settings. +This reduces manual configuration of the content proxy server host. +The ZOOM module will use the old style session.proxyhost if "server" +is given (deprecated) and use the new style proxyhost/session if +"config_file" is in use. + +frontend_net: remove incoming requests that can not be handled +Requests in queue for filter frontend_net are removed if client +closes connection for the session and request is not yet handled. + +sru_z3950: serialize requests. This is to ensure that pipelined +HTTP requests are handled properly. + --- 1.3.28 2012/04/04 New class, wrbuf, that wraps YAZ' WRBUF. diff --git a/debian/changelog b/debian/changelog index f0fe8fb..13939bc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +metaproxy (1.3.29-1indexdata) unstable; urgency=low + + * Upstream. + + -- Adam Dickmeiss Wed, 18 Apr 2012 13:18:41 +0200 + metaproxy (1.3.28-1indexdata) unstable; urgency=low * Upstream. diff --git a/doc/zoom.xml b/doc/zoom.xml index ef6974a..f88c5b4 100644 --- a/doc/zoom.xml +++ b/doc/zoom.xml @@ -233,6 +233,17 @@ + attribute config_file + + + Specifies the file that configures the cf-proxy system. Metaproxy + uses setting sessiondir and + proxyhostname from that file to configure + name of proxy host and directory of parameter files for the cf-proxy. + + + + attribute server @@ -240,6 +251,12 @@ host[:port]. That is without a method (such as HTTP) and optional port number. + + + This setting is deprecated. Use the config_file (above) + to inform about the proxy server. + + @@ -252,6 +269,12 @@ using the mkstemp(3) system call. The default value of this setting is /tmp/cf.XXXXXX.p. + + + This setting is deprecated. Use the config_file (above) + to inform about the session file area. + + diff --git a/etc/config-zoom.xml b/etc/config-zoom.xml index b6be3fd..938d97a 100644 --- a/etc/config-zoom.xml +++ b/etc/config-zoom.xml @@ -29,8 +29,8 @@ 1=4 s=pw t=l,r usmarc tmarc.xsl - http://sever.com?title=${md-title[\s+/+/g]} - localhost:9998/db01 + http://sever.com?title=${md-title[\s+/+/g]}&parm=1 + localhost:9998/Default?search-delay=2&present-delay=2 heikki/content1 @@ -194,8 +194,7 @@ @@ -206,15 +205,16 @@ F + - + B - + diff --git a/src/filter_zoom.cpp b/src/filter_zoom.cpp index bf6f4ab..34b3084 100644 --- a/src/filter_zoom.cpp +++ b/src/filter_zoom.cpp @@ -91,7 +91,7 @@ namespace metaproxy_1 { std::string m_frontend_database; SearchablePtr sptr; xsltStylesheetPtr xsp; - std::string content_session_id; + std::string cproxy_host; bool enable_cproxy; bool enable_explain; xmlDoc *explain_doc; @@ -201,6 +201,7 @@ namespace metaproxy_1 { std::string file_path; std::string content_proxy_server; std::string content_tmp_file; + std::string content_config_file; bool apdu_log; CCL_bibset bibset; std::string element_transform; @@ -622,7 +623,6 @@ void yf::Zoom::Impl::configure(const xmlNode *ptr, bool test_only, std::string explain_xslt_fname; std::string record_xslt_fname; - content_tmp_file = "/tmp/cf.XXXXXX.p"; if (path && *path) { file_path = path; @@ -695,9 +695,19 @@ void yf::Zoom::Impl::configure(const xmlNode *ptr, bool test_only, for (attr = ptr->properties; attr; attr = attr->next) { if (!strcmp((const char *) attr->name, "server")) + { + yaz_log(YLOG_WARN, + "contentProxy's server attribute is deprecated"); + yaz_log(YLOG_LOG, + "Specify config_file instead. For example:"); + yaz_log(YLOG_LOG, + " content_file=\"/etc/cf-proxy/cproxy.cfg\""); content_proxy_server = mp::xml::get_text(attr->children); + } else if (!strcmp((const char *) attr->name, "tmp_file")) content_tmp_file = mp::xml::get_text(attr->children); + else if (!strcmp((const char *) attr->name, "config_file")) + content_config_file = mp::xml::get_text(attr->children); else throw mp::filter::FilterException( "Bad attribute " + std::string((const char *) @@ -820,16 +830,98 @@ bool yf::Zoom::Frontend::create_content_session(mp::Package &package, { if (b->sptr->contentConnector.length()) { - char *fname = (char *) xmalloc(m_p->content_tmp_file.length() + 8); - strcpy(fname, m_p->content_tmp_file.c_str()); + std::string proxyhostname; + std::string tmp_file; + bool legacy_format = false; + + if (m_p->content_proxy_server.length()) + { + proxyhostname = m_p->content_proxy_server; + legacy_format = true; + } + + if (m_p->content_tmp_file.length()) + tmp_file = m_p->content_tmp_file; + + if (m_p->content_config_file.length()) + { + FILE *inf = fopen(m_p->content_config_file.c_str(), "r"); + if (inf) + { + char buf[1024]; + while (fgets(buf, sizeof(buf)-1, inf)) + { + char *cp; + cp = strchr(buf, '#'); + if (cp) + *cp = '\0'; + cp = strchr(buf, '\n'); + if (cp) + *cp = '\0'; + cp = strchr(buf, ':'); + if (cp) + { + char *cp1 = cp; + while (cp1 != buf && cp1[-1] == ' ') + cp1--; + *cp1 = '\0'; + cp++; + while (*cp == ' ') + cp++; + if (!strcmp(buf, "proxyhostname")) + proxyhostname = cp; + if (!strcmp(buf, "sessiondir") && *cp) + { + if (cp[strlen(cp)-1] == '/') + cp[strlen(cp)-1] = '\0'; + tmp_file = std::string(cp) + std::string("/cf.XXXXXX.p"); + } + } + } + fclose(inf); + } + else + { + package.log("zoom", YLOG_WARN|YLOG_ERRNO, + "unable to open content config %s", + m_p->content_config_file.c_str()); + *error = YAZ_BIB1_TEMPORARY_SYSTEM_ERROR; + *addinfo = (char *) odr_malloc(odr, 60 + tmp_file.length()); + sprintf(*addinfo, "unable to open content config %s", + m_p->content_config_file.c_str()); + return false; + } + } + + if (proxyhostname.length() == 0) + { + package.log("zoom", YLOG_WARN, "no proxyhostname"); + return true; + } + if (tmp_file.length() == 0) + { + package.log("zoom", YLOG_WARN, "no tmp_file"); + return true; + } + + char *fname = xstrdup(tmp_file.c_str()); char *xx = strstr(fname, "XXXXXX"); if (!xx) { - xx = fname + strlen(fname); - strcat(fname, "XXXXXX"); + package.log("zoom", YLOG_WARN, "bad tmp_file %s", tmp_file.c_str()); + *error = YAZ_BIB1_TEMPORARY_SYSTEM_ERROR; + *addinfo = (char *) odr_malloc(odr, 60 + tmp_file.length()); + sprintf(*addinfo, "bad format of content tmp_file: %s", + tmp_file.c_str()); + xfree(fname); + return false; } char tmp_char = xx[6]; sprintf(xx, "%06d", ((unsigned) rand()) % 1000000); + if (legacy_format) + b->cproxy_host = std::string(xx) + "." + proxyhostname; + else + b->cproxy_host = proxyhostname + "/" + xx; xx[6] = tmp_char; FILE *file = fopen(fname, "w"); @@ -842,7 +934,6 @@ bool yf::Zoom::Frontend::create_content_session(mp::Package &package, xfree(fname); return false; } - b->content_session_id.assign(xx, 6); mp::wrbuf w; wrbuf_puts(w, "#content_proxy\n"); wrbuf_printf(w, "connector: %s\n", b->sptr->contentConnector.c_str()); @@ -1409,11 +1500,12 @@ Z_Records *yf::Zoom::Frontend::get_records(Package &package, const char *xsl_parms[3]; mp::wrbuf cproxy_host; - if (b->enable_cproxy && b->content_session_id.length()) + if (b->enable_cproxy && b->cproxy_host.length()) { - wrbuf_printf(cproxy_host, "\"%s.%s/\"", - b->content_session_id.c_str(), - m_p->content_proxy_server.c_str()); + wrbuf_puts(cproxy_host, "\""); + wrbuf_puts(cproxy_host, b->cproxy_host.c_str()); + wrbuf_puts(cproxy_host, "/\""); + xsl_parms[0] = "cproxyhost"; xsl_parms[1] = wrbuf_cstr(cproxy_host); xsl_parms[2] = 0; diff --git a/win/makefile b/win/makefile index 3c48fc3..7012053 100644 --- a/win/makefile +++ b/win/makefile @@ -7,7 +7,7 @@ DEBUG=0 # 0 for release, 1 for debug # Metaproxy version -VERSION=1.3.28 +VERSION=1.3.29 # YAZ and YAZ++ directories YAZ_DIR=..\..\yaz diff --git a/xml/schema/filter_zoom.rnc b/xml/schema/filter_zoom.rnc index 1b5f900..1599ce8 100644 --- a/xml/schema/filter_zoom.rnc +++ b/xml/schema/filter_zoom.rnc @@ -62,6 +62,7 @@ filter_zoom = }* }?, element mp:contentProxy { + attribute config_file { xsd:string }?, attribute server { xsd:string }?, attribute tmp_file { xsd:string }? }?,