std::string m_backend_database;
std::string m_vhost;
std::string m_route;
+ std::string m_auth;
void operator() (void); // thread operation
};
struct Multi::Frontend {
class Multi::Map {
std::string m_target_pattern;
std::string m_route;
+ std::string m_auth;
public:
- Map(std::string pattern, std::string route) :
- m_target_pattern(pattern), m_route(route) {};
- bool match(const std::string target, std::string *ret) const {
+ Map(std::string pattern, std::string route, std::string auth) :
+ m_target_pattern(pattern), m_route(route), m_auth(auth) {};
+ bool match(const std::string target, std::string *ret,
+ std::string *auth) const {
if (yaz_match_glob(m_target_pattern.c_str(), target.c_str()))
{
*ret = m_route;
+ *auth = m_auth;
return true;
}
return false;
std::list<Multi::Map>::const_iterator it =
m_p->m_route_patterns.begin();
while (it != m_p->m_route_patterns.end()) {
- if (it->match(*t_it, &b->m_route))
+ if (it->match(*t_it, &b->m_route, &b->m_auth))
break;
it++;
}
Z_InitRequest *breq = init_apdu->u.initRequest;
- breq->idAuthentication = req->idAuthentication;
+ if (b->m_auth.length())
+ {
+ breq->idAuthentication =
+ (Z_IdAuthentication *)
+ odr_malloc(odr, sizeof(*breq->idAuthentication));
+ breq->idAuthentication->which = Z_IdAuthentication_open;
+ breq->idAuthentication->u.open = odr_strdup(odr, b->m_auth.c_str());
+ }
+ else
+ breq->idAuthentication = req->idAuthentication;
*breq->preferredMessageSize = *req->preferredMessageSize;
*breq->maximumRecordSize = *req->maximumRecordSize;
maximumRecordSize = *b_resp->maximumRecordSize;
}
else
+ {
+ if (!f_resp->userInformationField
+ && b_resp->userInformationField)
+ f_resp->userInformationField = b_resp->userInformationField;
no_failed++;
+ }
}
else
no_failed++;
// they are altered now - to disable piggyback
*req->smallSetUpperBound = 0;
*req->largeSetLowerBound = 1;
- *req->mediumSetPresentNumber = 1;
+ *req->mediumSetPresentNumber = 0;
int default_num_db = req->num_databaseNames;
char **default_db = req->databaseNames;
continue;
if (!strcmp((const char *) ptr->name, "target"))
{
- std::string route = mp::xml::get_route(ptr);
+ std::string auth;
+ std::string route = mp::xml::get_route(ptr, auth);
std::string target = mp::xml::get_text(ptr);
if (target.length() == 0)
target = route;
- m_p->m_route_patterns.push_back(Multi::Map(target, route));
+ m_p->m_route_patterns.push_back(Multi::Map(target, route, auth));
}
else if (!strcmp((const char *) ptr->name, "hideunavailable"))
{