{ // must have a destructor because of boost::scoped_ptr
}
-void yf::Zoom::configure(const xmlNode *xmlnode, bool test_only)
+void yf::Zoom::configure(const xmlNode *xmlnode, bool test_only,
+ const char *path)
{
m_p->configure(xmlnode, test_only);
}
if (m_backend && m_backend->m_frontend_database == database)
return m_backend;
+ const char *sru_proxy = 0;
std::string db_args;
std::string torus_db;
size_t db_arg_pos = database.find(',');
{
// A CF target
b->set_option("user", sptr->cfAuth.c_str());
- if (authentication.length() && db_args.length() == 0)
+ if (db_args.length() == 0)
{
- // no database (auth) args specified already.. and the
- // Torus authentication has it.. Generate the args that CF
- // understands..
- size_t found = authentication.find('/');
- if (found != std::string::npos)
+ if (authentication.length())
{
- db_args += "user=" + mp::util::uri_encode(authentication.substr(0, found))
- + "&password=" + mp::util::uri_encode(authentication.substr(found+1));
+ // no database (auth) args specified already.. and the
+ // Torus authentication has it.. Generate the args that CF
+ // understands..
+ size_t found = authentication.find('/');
+ if (found != std::string::npos)
+ {
+ db_args += "user=" + mp::util::uri_encode(authentication.substr(0, found))
+ + "&password=" + mp::util::uri_encode(authentication.substr(found+1));
+ }
+ else
+ db_args += "user=" + mp::util::uri_encode(authentication);
}
- else
- db_args += "user=" + mp::util::uri_encode(authentication);
+ if (sptr->cfProxy.length())
+ {
+ if (db_args.length())
+ db_args += "&";
+ db_args += "proxy=" + mp::util::uri_encode(sptr->cfProxy);
+ }
+ }
+ if (sptr->cfSubDb.length())
+ {
+ if (db_args.length())
+ db_args += "&";
+ db_args += "subdatabase=" + mp::util::uri_encode(sptr->cfSubDb);
}
}
else
param_user = value;
else if (!strcmp(name, "password"))
param_password = value;
+ else if (!strcmp(name, "proxy"))
+ sru_proxy = value;
else
{
BackendPtr notfound;
b->set_option("user", authentication.c_str());
}
}
- if (sptr->cfProxy.length())
- {
- if (db_args.length())
- db_args += "&";
- db_args += "proxy=" + mp::util::uri_encode(sptr->cfProxy);
- }
- if (sptr->cfSubDb.length())
- {
- if (db_args.length())
- db_args += "&";
- db_args += "subdatabase=" + mp::util::uri_encode(sptr->cfSubDb);
- }
+
+ if (sru_proxy)
+ b->set_option("proxy", sru_proxy);
std::string url;
if (sptr->sru.length())
}
int rec_len;
+ xmlChar *xmlrec_buf = 0;
const char *rec_buf = ZOOM_record_get(recs[i], rec_type_str,
&rec_len);
if (rec_buf && b->xsp && enable_pz2_transform)
rec_res = xsltApplyStylesheet(b->xsp, rec_doc, 0);
if (rec_res)
- xsltSaveResultToString((xmlChar **) &rec_buf, &rec_len,
+ xsltSaveResultToString(&xmlrec_buf, &rec_len,
rec_res, b->xsp);
+ rec_buf = (const char *) xmlrec_buf;
+ xmlFreeDoc(rec_doc);
+ xmlFreeDoc(rec_res);
}
}
if (rec_buf)
{
xmlDoc *doc = xmlParseMemory(rec_buf, rec_len);
- mp::xml::url_recipe_handle(doc, b->sptr->urlRecipe);
+ std::string res =
+ mp::xml::url_recipe_handle(doc, b->sptr->urlRecipe);
+ if (res.length())
+ {
+ xmlNode *ptr = xmlDocGetRootElement(doc);
+ while (ptr && ptr->type != XML_ELEMENT_NODE)
+ ptr = ptr->next;
+ xmlNode *c =
+ xmlNewChild(ptr, 0, BAD_CAST "generated-url", 0);
+ xmlNode * t = xmlNewText(BAD_CAST res.c_str());
+ xmlAddChild(c, t);
+
+ if (xmlrec_buf)
+ xmlFree(xmlrec_buf);
+
+ xmlDocDumpMemory(doc, &xmlrec_buf, &rec_len);
+ rec_buf = (const char *) xmlrec_buf;
+ }
xmlFreeDoc(doc);
}
if (rec_buf)
YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS,
rec_type_str);
}
+ if (xmlrec_buf)
+ xmlFree(xmlrec_buf);
}
else
{