projects
/
yazpp-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix make dist for windows
[yazpp-moved-to-github.git]
/
proxy
/
yaz-proxy.cpp
diff --git
a/proxy/yaz-proxy.cpp
b/proxy/yaz-proxy.cpp
index
82cd41e
..
c4db080
100644
(file)
--- a/
proxy/yaz-proxy.cpp
+++ b/
proxy/yaz-proxy.cpp
@@
-1,4
+1,4
@@
-/* $Id: yaz-proxy.cpp,v 1.1 2004-03-29 22:46:51 adam Exp $
+/* $Id: yaz-proxy.cpp,v 1.4 2004-03-30 18:14:13 adam Exp $
Copyright (c) 1998-2004, Index Data.
This file is part of the yaz-proxy.
Copyright (c) 1998-2004, Index Data.
This file is part of the yaz-proxy.
@@
-19,7
+19,11
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
02111-1307, USA.
*/
+#ifdef WIN32
+#else
#include <unistd.h>
#include <unistd.h>
+#endif
+
#include <assert.h>
#include <time.h>
#include <sys/types.h>
#include <assert.h>
#include <time.h>
#include <sys/types.h>
@@
-143,8
+147,10
@@
Yaz_Proxy::Yaz_Proxy(IYaz_PDU_Observable *the_PDU_Observable,
m_http_version = 0;
m_soap_ns = 0;
m_s2z_packing = Z_SRW_recordPacking_string;
m_http_version = 0;
m_soap_ns = 0;
m_s2z_packing = Z_SRW_recordPacking_string;
+#if HAVE_GETTIMEOFDAY
m_time_tv.tv_sec = 0;
m_time_tv.tv_usec = 0;
m_time_tv.tv_sec = 0;
m_time_tv.tv_usec = 0;
+#endif
if (!m_parent)
low_socket_open();
}
if (!m_parent)
low_socket_open();
}
@@
-162,9
+168,10
@@
Yaz_Proxy::~Yaz_Proxy()
xfree (m_proxy_authentication);
xfree (m_optimize);
xfree (m_proxy_authentication);
xfree (m_optimize);
+#if HAVE_XSLT
if (m_stylesheet_xsp)
xsltFreeStylesheet(m_stylesheet_xsp);
if (m_stylesheet_xsp)
xsltFreeStylesheet(m_stylesheet_xsp);
-
+#endif
xfree (m_schema);
if (m_s2z_odr_init)
odr_destroy(m_s2z_odr_init);
xfree (m_schema);
if (m_s2z_odr_init)
odr_destroy(m_s2z_odr_init);
@@
-354,7
+361,7
@@
Yaz_ProxyClient *Yaz_Proxy::get_client(Z_APDU *apdu, const char *cookie,
Yaz_ProxyConfig *cfg = check_reconfigure();
if (proxy_host)
{
Yaz_ProxyConfig *cfg = check_reconfigure();
if (proxy_host)
{
-#if 1
+#if 0
/* only to be enabled for debugging... */
if (!strcmp(proxy_host, "stop"))
exit(0);
/* only to be enabled for debugging... */
if (!strcmp(proxy_host, "stop"))
exit(0);
@@
-648,6
+655,7
@@
int Yaz_Proxy::convert_xsl(Z_NamePlusRecordList *p, Z_APDU *apdu)
void Yaz_Proxy::convert_xsl_delay()
{
Z_NamePlusRecord *npr = m_stylesheet_nprl->records[m_stylesheet_offset];
void Yaz_Proxy::convert_xsl_delay()
{
Z_NamePlusRecord *npr = m_stylesheet_nprl->records[m_stylesheet_offset];
+#if HAVE_XSLT
if (npr->which == Z_NamePlusRecord_databaseRecord)
{
Z_External *r = npr->u.databaseRecord;
if (npr->which == Z_NamePlusRecord_databaseRecord)
{
Z_External *r = npr->u.databaseRecord;
@@
-682,12
+690,15
@@
void Yaz_Proxy::convert_xsl_delay()
xmlFreeDoc(doc);
}
}
xmlFreeDoc(doc);
}
}
+#endif
m_stylesheet_offset++;
if (m_stylesheet_offset == m_stylesheet_nprl->num_records)
{
m_stylesheet_nprl = 0;
m_stylesheet_offset++;
if (m_stylesheet_offset == m_stylesheet_nprl->num_records)
{
m_stylesheet_nprl = 0;
+#if HAVE_XSLT
if (m_stylesheet_xsp)
xsltFreeStylesheet(m_stylesheet_xsp);
if (m_stylesheet_xsp)
xsltFreeStylesheet(m_stylesheet_xsp);
+#endif
m_stylesheet_xsp = 0;
timeout(m_client_idletime);
send_PDU_convert(m_stylesheet_apdu);
m_stylesheet_xsp = 0;
timeout(m_client_idletime);
send_PDU_convert(m_stylesheet_apdu);
@@
-732,6
+743,7
@@
void Yaz_Proxy::convert_to_marcxml(Z_NamePlusRecordList *p)
void Yaz_Proxy::logtime()
{
void Yaz_Proxy::logtime()
{
+#if HAVE_GETTIMEOFDAY
if (m_time_tv.tv_sec)
{
struct timeval tv;
if (m_time_tv.tv_sec)
{
struct timeval tv;
@@
-744,6
+756,7
@@
void Yaz_Proxy::logtime()
}
m_time_tv.tv_sec = 0;
m_time_tv.tv_usec = 0;
}
m_time_tv.tv_sec = 0;
m_time_tv.tv_usec = 0;
+#endif
}
int Yaz_Proxy::send_http_response(int code)
}
int Yaz_Proxy::send_http_response(int code)
@@
-1394,7
+1407,9
@@
void Yaz_Proxy::recv_GDU(Z_GDU *apdu, int len)
m_bw_stat.add_bytes(len);
m_pdu_stat.add_bytes(1);
m_bw_stat.add_bytes(len);
m_pdu_stat.add_bytes(1);
+#if HAVE_GETTIMEOFDAY
gettimeofday(&m_time_tv, 0);
gettimeofday(&m_time_tv, 0);
+#endif
int bw_total = m_bw_stat.get_total();
int pdu_total = m_pdu_stat.get_total();
int bw_total = m_bw_stat.get_total();
int pdu_total = m_pdu_stat.get_total();
@@
-1569,11
+1584,12
@@
Z_APDU *Yaz_Proxy::handle_syntax_validation(Z_APDU *apdu)
{
m_parent->low_socket_close();
{
m_parent->low_socket_close();
+#if HAVE_XSLT
if (m_stylesheet_xsp)
xsltFreeStylesheet(m_stylesheet_xsp);
if (m_stylesheet_xsp)
xsltFreeStylesheet(m_stylesheet_xsp);
-
m_stylesheet_xsp = xsltParseStylesheetFile((const xmlChar*)
stylesheet_name);
m_stylesheet_xsp = xsltParseStylesheetFile((const xmlChar*)
stylesheet_name);
+#endif
m_stylesheet_offset = 0;
xfree(stylesheet_name);
m_stylesheet_offset = 0;
xfree(stylesheet_name);
@@
-1616,11
+1632,13
@@
Z_APDU *Yaz_Proxy::handle_syntax_validation(Z_APDU *apdu)
{
m_parent->low_socket_close();
{
m_parent->low_socket_close();
+#if HAVE_XSLT
if (m_stylesheet_xsp)
xsltFreeStylesheet(m_stylesheet_xsp);
m_stylesheet_xsp = xsltParseStylesheetFile((const xmlChar*)
stylesheet_name);
if (m_stylesheet_xsp)
xsltFreeStylesheet(m_stylesheet_xsp);
m_stylesheet_xsp = xsltParseStylesheetFile((const xmlChar*)
stylesheet_name);
+#endif
m_stylesheet_offset = 0;
xfree(stylesheet_name);
m_stylesheet_offset = 0;
xfree(stylesheet_name);
@@
-1726,13
+1744,6
@@
void Yaz_Proxy::handle_incoming_HTTP(Z_HTTP_Request *hreq)
&diagnostic, &num_diagnostic,
72, 0);
}
&diagnostic, &num_diagnostic,
72, 0);
}
- // must have a query
- if (!srw_req->query.cql)
- {
- yaz_add_srw_diagnostic(odr_decode(),
- &diagnostic, &num_diagnostic,
- 7, "query");
- }
// sort unsupported
if (srw_req->sort_type != Z_SRW_sort_type_none)
{
// sort unsupported
if (srw_req->sort_type != Z_SRW_sort_type_none)
{
@@
-2570,17
+2581,23
@@
void Yaz_ProxyClient::recv_Z_PDU(Z_APDU *apdu, int len)
void Yaz_Proxy::low_socket_close()
{
void Yaz_Proxy::low_socket_close()
{
+#if WIN32
+#else
int i;
for (i = 0; i<NO_SPARE_SOLARIS_FD; i++)
if (m_lo_fd[i] >= 0)
::close(m_lo_fd[i]);
int i;
for (i = 0; i<NO_SPARE_SOLARIS_FD; i++)
if (m_lo_fd[i] >= 0)
::close(m_lo_fd[i]);
+#endif
}
void Yaz_Proxy::low_socket_open()
{
}
void Yaz_Proxy::low_socket_open()
{
+#if WIN32
+#else
int i;
for (i = 0; i<NO_SPARE_SOLARIS_FD; i++)
m_lo_fd[i] = open("/dev/null", O_RDONLY);
int i;
for (i = 0; i<NO_SPARE_SOLARIS_FD; i++)
m_lo_fd[i] = open("/dev/null", O_RDONLY);
+#endif
}
int Yaz_Proxy::server(const char *addr)
}
int Yaz_Proxy::server(const char *addr)
@@
-2588,7
+2605,11
@@
int Yaz_Proxy::server(const char *addr)
int r = Yaz_Z_Assoc::server(addr);
if (!r)
{
int r = Yaz_Z_Assoc::server(addr);
if (!r)
{
- yaz_log(LOG_LOG, "%sStarted proxy " VERSION " on %s", m_session_str, addr);
+ yaz_log(LOG_LOG, "%sStarted proxy "
+#ifdef VERSION
+ VERSION
+#endif
+ " on %s", m_session_str, addr);
timeout(1);
}
return r;
timeout(1);
}
return r;