/* This file is part of Metaproxy.
- Copyright (C) 2005-2011 Index Data
+ Copyright (C) 2005-2012 Index Data
Metaproxy is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
SearchablePtr sptr;
xsltStylesheetPtr xsp;
std::string content_session_id;
+ bool enable_cproxy;
public:
Backend(SearchablePtr sptr);
~Backend();
char **addinfo,
ODR odr,
std::string authentication,
- std::string proxy);
+ std::string proxy,
+ std::string realm);
void prepare_elements(BackendPtr b,
Odr_oid *preferredRecordSyntax,
ZOOM_connection_save_apdu_wrbuf(m_connection, m_apdu_wrbuf);
m_resultset = 0;
xsp = 0;
+ enable_cproxy = true;
}
yf::Zoom::Backend::~Backend()
xsltFreeStylesheet(xsp);
ZOOM_connection_destroy(m_connection);
ZOOM_resultset_destroy(m_resultset);
+ wrbuf_destroy(m_apdu_wrbuf);
}
void yf::Zoom::Backend::search(ZOOM_query q, Odr_int *hits,
int *error, char **addinfo, ODR odr)
{
+ ZOOM_resultset_destroy(m_resultset);
m_resultset = ZOOM_connection_search(m_connection, q);
get_zoom_error(error, addinfo, odr);
if (*error == 0)
int *error, char **addinfo,
ODR odr,
std::string authentication,
- std::string proxy)
+ std::string proxy,
+ std::string realm)
{
if (b->sptr->contentConnector.length())
{
wrbuf_printf(w, "auth: %s\n", authentication.c_str());
if (proxy.length())
wrbuf_printf(w, "proxy: %s\n", proxy.c_str());
+ if (realm.length())
+ wrbuf_printf(w, "realm: %s\n", realm.c_str());
fwrite(wrbuf_buf(w), 1, wrbuf_len(w), file);
fclose(file);
package.log("zoom", YLOG_LOG, "content file: %s", fname);
xfree(fname);
+ wrbuf_destroy(w);
}
return true;
}
b->xsp = xsp;
b->m_frontend_database = database;
+ b->enable_cproxy = param_nocproxy ? false : true;
if (sptr->query_encoding.length())
b->set_option("rpnCharset", sptr->query_encoding);
}
package.log("zoom", YLOG_LOG, "url: %s", url.c_str());
b->connect(url, error, addinfo, odr);
- if (*error == 0 && !param_nocproxy)
+ if (*error == 0 && b->enable_cproxy)
create_content_session(package, b, error, addinfo, odr,
content_authentication.length() ?
content_authentication : authentication,
- content_proxy.length() ? content_proxy : proxy);
+ content_proxy.length() ? content_proxy : proxy,
+ realm);
if (*error == 0)
m_backend = b;
return b;
Z_NamePlusRecord *npr = 0;
const char *addinfo;
- package.log("zoom", YLOG_LOG, "Inspecting record at position %d",
- start + i);
int sur_error = ZOOM_record_error(recs[i], 0 /* msg */,
&addinfo, 0 /* diagset */);
}
}
- if (rec_buf)
+ if (rec_buf && b->enable_cproxy)
{
xmlDoc *doc = xmlParseMemory(rec_buf, rec_len);
std::string res =