"Content-Type", "text/plain");
http_res->content_buf =
- odr_strdup(odr, "Welcome to YP2");
+ odr_strdup(odr, "Welcome to Metaproxy");
http_res->content_len = strlen(http_res->content_buf);
package.response() = gdu;
namespace filter {
class Session_info {
int dummy;
+ public:
+ Session_info() { dummy = 0; };
};
class BackendTest::Rep {
friend class BackendTest;
return 1;
}
// and perform Xinclude then
- if (xmlXIncludeProcess(doc) > 0) {
- yaz_log (YLOG_LOG, "processing XInclude directive");
+ int r = xmlXIncludeProcess(doc);
+ if (r == -1)
+ {
+ yaz_log(YLOG_FATAL, "XInclude processing failed");
+ return 1;
}
mp::FactoryStatic factory;
mp::RouterFleXML router(doc, factory, false);
return 1;
}
catch (std::runtime_error &e) {
- yaz_log (YLOG_FATAL, "std::runtime error: %s" , e.what() );
+ yaz_log(YLOG_FATAL, "std::runtime error: %s" , e.what() );
return 1;
}
catch ( ... ) {
- yaz_log (YLOG_FATAL, "Unknown Exception");
+ yaz_log(YLOG_FATAL, "Unknown Exception");
return 1;
}
return 0;
bool mp_util::build_sru_response(mp::Package &package,
- mp::odr &odr_en,
- Z_SOAP *soap,
- const Z_SRW_PDU *sru_pdu_res,
- char *charset,
- const char *stylesheet)
+ mp::odr &odr_en,
+ Z_SOAP *soap,
+ const Z_SRW_PDU *sru_pdu_res,
+ char *charset,
+ const char *stylesheet)
{
// SRU request package translation to Z3950 package
//http_res->code = http_code;
std::string ctype("text/xml");
- if (charset){
+ if (charset)
+ {
ctype += "; charset=";
ctype += charset;
}
// packaging Z_SOAP into HTML response
static Z_SOAP_Handler soap_handlers[4] = {
- {"http://www.loc.gov/zing/srw/", 0,
- (Z_SOAP_fun) yaz_srw_codec},
- {"http://www.loc.gov/zing/srw/v1.0/", 0,
- (Z_SOAP_fun) yaz_srw_codec},
- {"http://www.loc.gov/zing/srw/update/", 0,
- (Z_SOAP_fun) yaz_ucp_codec},
- {0, 0, 0}
+ {(char *)YAZ_XMLNS_SRU_v1_1, 0, (Z_SOAP_fun) yaz_srw_codec},
+ {(char *)YAZ_XMLNS_SRU_v1_0, 0, (Z_SOAP_fun) yaz_srw_codec},
+ {(char *)YAZ_XMLNS_UPDATE_v0_9, 0, (Z_SOAP_fun) yaz_ucp_codec},
+ {0, 0, 0}
};
}
Z_GDU *gdu = package.request().get();
- if (gdu)
+ if (gdu && gdu->which == Z_GDU_Z3950)
{
// std::cout << "Got PDU. Sending init response\n";
mp::odr odr;
- Z_APDU *apdu = zget_APDU(odr, Z_APDU_initResponse);
-
- apdu->u.initResponse->implementationName = "YP2/YAZ";
-
+ Z_APDU *apdu = odr.create_initResponse(gdu->u.z3950, 0, 0);
package.response() = apdu;
}
package.move();
}
Z_GDU *gdu = package.request().get();
- if (gdu)
+ if (gdu && gdu->which == Z_GDU_Z3950)
{
// std::cout << "Got PDU. Sending init response\n";
mp::odr odr;
- Z_APDU *apdu = zget_APDU(odr, Z_APDU_initResponse);
-
- apdu->u.initResponse->implementationName = "YP2/YAZ";
-
+ Z_APDU *apdu = odr.create_initResponse(gdu->u.z3950, 0, 0);
package.response() = apdu;
}
return package.move();
}
Z_GDU *gdu = package.request().get();
- if (gdu)
+ if (gdu && gdu->which == Z_GDU_Z3950)
{
// std::cout << "Got PDU. Sending init response\n";
mp::odr odr;
- Z_APDU *apdu = zget_APDU(odr, Z_APDU_initResponse);
-
- apdu->u.initResponse->implementationName = "YP2/YAZ";
-
+ Z_APDU *apdu = odr.create_initResponse(gdu->u.z3950, 0, 0);
package.response() = apdu;
}
return package.move();
}
Z_GDU *gdu = package.request().get();
- if (gdu)
+ if (gdu && gdu->which == Z_GDU_Z3950)
{
// std::cout << "Got PDU. Sending init response\n";
mp::odr odr;
- Z_APDU *apdu = zget_APDU(odr, Z_APDU_initResponse);
-
- apdu->u.initResponse->implementationName = "YP2/YAZ";
-
+ Z_APDU *apdu = odr.create_initResponse(gdu->u.z3950, 0, 0);
package.response() = apdu;
}
package.move();
{
public:
Worker(int nr = 0)
- : m_nr(nr){};
+ : m_nr(nr), m_id(0) {};
void operator() (void) {
for (int i=0; i < 100; ++i)
#ifdef WIN32
recv(m_p->m_pipe.read_fd(), buf, 1, 0);
#else
- read(m_p->m_pipe.read_fd(), buf, 1);
+ ssize_t r = read(m_p->m_pipe.read_fd(), buf, 1);
+ if (r != 1)
+ {
+ if (r == (ssize_t) (-1))
+ yaz_log(YLOG_WARN|YLOG_ERRNO,
+ "ThreadPoolSocketObserver::socketNotify. read fail");
+ else
+ yaz_log(YLOG_WARN,
+ "ThreadPoolSocketObserver::socketNotify. read returned 0");
+ }
#endif
IThreadPoolMsg *out;
{
#ifdef WIN32
send(m_p->m_pipe.write_fd(), "", 1, 0);
#else
- write(m_p->m_pipe.write_fd(), "", 1);
+ ssize_t r = write(m_p->m_pipe.write_fd(), "", 1);
+ if (r != 1)
+ {
+ if (r == (ssize_t) (-1))
+ yaz_log(YLOG_WARN|YLOG_ERRNO,
+ "ThreadPoolSocketObserver::run. write fail");
+ else
+ yaz_log(YLOG_WARN,
+ "ThreadPoolSocketObserver::run. write returned 0");
+ }
#endif
}
}
zget_init_diagnostics(m_odr, error, addinfo);
*apdu->u.initResponse->result = 0;
}
+ apdu->u.initResponse->implementationName =
+ odr_prepend(m_odr, "Metaproxy",
+ apdu->u.initResponse->implementationName);
+ apdu->u.initResponse->implementationVersion =
+ odr_prepend(m_odr,
+ VERSION, apdu->u.initResponse->implementationVersion);
+
return apdu;
}
int mediumSetPresentNumber,
int result_set_size,
int &number_to_present);
+
};
class odr : public boost::noncopyable {