+Per database config.
+
Control the various optimizations with config..
Live status (via search, present).
Possible threading.
-Throw proper diagnostic for bad schema (Z39.50/SRW).
-
Deal with Z39.50 options properly.
Deal with Z39.50 messages sizes properly.
For SRW/SRU, set schema for each returned record.
-Fork to ensure that crashes are catched.
+Character set conversion for SRW queries.
+
+Throw proper CQL conversion error.
* Copyright (c) 1998-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: proxy.h,v 1.26 2004-01-05 11:31:04 adam Exp $
+ * $Id: proxy.h,v 1.27 2004-01-06 21:17:42 adam Exp $
*/
#include <sys/time.h>
Yaz_cql2rpn();
~Yaz_cql2rpn();
void set_pqf_file(const char *fname);
- int query_transform(const char *cql, Z_RPNQuery **rpnquery, ODR o);
+ int query_transform(const char *cql, Z_RPNQuery **rpnquery, ODR o,
+ char **addinfop);
private:
cql_transform_t m_transform;
};
* Copyright (c) 1998-2003, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-cql2rpn.cpp,v 1.2 2003-12-20 22:44:30 adam Exp $
+ * $Id: yaz-cql2rpn.cpp,v 1.3 2004-01-06 21:17:42 adam Exp $
*/
#include <yaz/log.h>
}
int Yaz_cql2rpn::query_transform(const char *cql_query,
- Z_RPNQuery **rpnquery, ODR o)
+ Z_RPNQuery **rpnquery, ODR o,
+ char **addinfop)
{
+ const char *addinfo = 0;
if (!m_transform)
return -3;
CQL_parser cp = cql_parser_create();
int r = cql_parser_string(cp, cql_query);
if (r)
+ {
yaz_log(LOG_LOG, "CQL Parse Error");
+ r = 10;
+ }
else
{
char rpn_buf[1024];
}
else
{
- const char *addinfo;
- cql_transform_error(m_transform, &addinfo);
+ r = cql_transform_error(m_transform, &addinfo);
yaz_log(LOG_LOG, "CQL Transform Error %d %s", r,
addinfo ? addinfo : "");
- r = -2;
}
}
cql_parser_destroy(cp);
+ if (addinfo)
+ *addinfop = odr_strdup(o, addinfo);
+ else
+ *addinfop = 0;
return r;
}
* Copyright (c) 1998-2003, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-proxy-config.cpp,v 1.18 2004-01-05 09:31:09 adam Exp $
+ * $Id: yaz-proxy-config.cpp,v 1.19 2004-01-06 21:17:42 adam Exp $
*/
#include <ctype.h>
*stylesheet = 0;
}
#if HAVE_XSLT
+ int syntax_has_matched = 0;
xmlNodePtr ptr;
ptr = find_target_node(name, 0);
}
}
if (match)
+ {
+ syntax_has_matched = 1;
match = check_esn(ptr->children, comp);
-
+ }
if (match)
{
if (stylesheet && match_stylesheet)
}
if (match_error)
{
+ if (syntax_has_matched) // if syntax did match, schema/ESN was bad
+ return 25;
if (syntax)
{
char dotoid_str[100];
* Copyright (c) 1998-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-proxy-main.cpp,v 1.27 2004-01-05 11:31:04 adam Exp $
+ * $Id: yaz-proxy-main.cpp,v 1.28 2004-01-06 21:17:42 adam Exp $
*/
#include <signal.h>
}
if (addr)
{
- yaz_log(LOG_LOG, "0 Starting proxy " VERSION );
if (proxy->server(addr))
{
yaz_log(LOG_FATAL|LOG_ERRNO, "listen %s", addr);
}
-static void child_run(Yaz_SocketManager *m)
+static void child_run(Yaz_SocketManager *m, int run)
{
- yaz_log(LOG_LOG, "0 proxy pid=%ld", (long) getpid());
+ signal(SIGHUP, sighup_handler);
+
+ yaz_log(LOG_LOG, "0 proxy run=%d pid=%ld", run, (long) getpid());
if (pid_fname)
{
FILE *f = fopen(pid_fname, "w");
int main(int argc, char **argv)
{
int cont = 1;
+ int run = 1;
static int mk_pid = 0;
Yaz_SocketManager mySocketManager;
Yaz_Proxy proxy(new Yaz_PDU_Assoc(&mySocketManager));
static_yaz_proxy = &proxy;
- signal(SIGHUP, sighup_handler);
args(&proxy, argc, argv);
if (debug)
{
- child_run(&mySocketManager);
+ child_run(&mySocketManager, run);
exit(0);
}
while (cont)
}
else if (p == 0)
{
- child_run(&mySocketManager);
+ child_run(&mySocketManager, run);
}
pid_t p1;
int status;
p1 = wait(&status);
+
+ yaz_log_reopen();
+
if (p1 != p)
{
yaz_log(LOG_FATAL, "p1=%d != p=%d", p1, p);
}
if (cont)
sleep(1);
+ run++;
}
exit (0);
return 0;
* Copyright (c) 1998-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-proxy.cpp,v 1.76 2004-01-05 11:31:04 adam Exp $
+ * $Id: yaz-proxy.cpp,v 1.77 2004-01-06 21:17:42 adam Exp $
*/
#include <assert.h>
{
Z_RPNQuery *rpnquery = 0;
Z_SearchRequest *sr = apdu->u.searchRequest;
+ char *addinfo = 0;
yaz_log(LOG_LOG, "%sCQL: %s", m_session_str,
sr->query->u.type_104->u.cql);
int r = m_cql2rpn.query_transform(sr->query->u.type_104->u.cql,
- &rpnquery, odr_encode());
+ &rpnquery, odr_encode(),
+ &addinfo);
if (r == -3)
yaz_log(LOG_LOG, "%sNo CQL to RPN table", m_session_str);
else if (r)
+ {
yaz_log(LOG_LOG, "%sCQL Conversion error %d", m_session_str, r);
+ Z_APDU *new_apdu = create_Z_PDU(Z_APDU_searchResponse);
+
+ new_apdu->u.searchResponse->referenceId = sr->referenceId;
+ new_apdu->u.searchResponse->records =
+ create_nonSurrogateDiagnostics(odr_encode(),
+ yaz_diag_srw_to_bib1(r),
+ addinfo);
+ *new_apdu->u.searchResponse->searchStatus = 0;
+
+ send_to_client(new_apdu);
+
+ return 0;
+ }
else
{
sr->query->which = Z_Query_type_1;
start = *srw_req->startRecord;
if (max > 0)
{
- if (start <= 1) // Z39.50 piggyback
+ // Some backend, such as Voyager doesn't honor piggyback
+ // So we use present always (0 &&).
+ if (0 && start <= 1) // Z39.50 piggyback
{
*z_searchRequest->smallSetUpperBound = max;
*z_searchRequest->mediumSetPresentNumber = max;
int r = Yaz_Z_Assoc::server(addr);
if (!r)
{
- yaz_log(LOG_LOG, "%sStarted listener on %s", m_session_str, addr);
+ yaz_log(LOG_LOG, "%sStarted proxy " VERSION " on %s", m_session_str, addr);
timeout(1);
}
return r;