* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: srwutil.c,v 1.61 2007-08-23 14:28:07 adam Exp $
+ * $Id: srwutil.c,v 1.64 2007-09-07 17:41:47 mike Exp $
*/
/**
* \file srwutil.c
Z_SRW_PDU *yaz_srw_get(ODR o, int which)
{
- return yaz_srw_get_pdu(o, which, "1.2");
+ return yaz_srw_get_pdu(o, which, "1.1");
}
Z_SRW_PDU *yaz_srw_get_pdu(ODR o, int which, const char *version)
}
/* bib1:srw */
-static int srw_bib1_map[] = {
+static int bib1_srw_map[] = {
1, 1,
2, 2,
3, 11,
0
};
+/*
+ * This array contains overrides for when the first occurrence of a
+ * particular SRW error in the array above does not correspond with
+ * the best back-translation of that SRW error.
+ */
+static int srw_bib1_map[] = {
+ 66, 238,
+ /* No doubt there are many more */
+ 0
+};
+
+
int yaz_diag_bib1_to_srw (int code)
{
- const int *p = srw_bib1_map;
+ const int *p = bib1_srw_map;
while (*p)
{
if (code == p[0])
int yaz_diag_srw_to_bib1(int code)
{
+ /* Check explicit reverse-map first */
const int *p = srw_bib1_map;
while (*p)
{
+ if (code == p[0])
+ return p[1];
+ p += 2;
+ }
+
+ /* Fall back on reverse lookup in main map */
+ p = bib1_srw_map;
+ while (*p)
+ {
if (code == p[1])
return p[0];
p += 2;
char *uri_args;
char *path;
+ z_HTTP_header_add_basic_auth(encode, &hreq->headers,
+ srw_pdu->username, srw_pdu->password);
if (yaz_get_sru_parms(srw_pdu, encode, name, value))
return -1;
yaz_array_to_uri_ex(&uri_args, encode, name, value, srw_pdu->extra_args);
char *name[30], *value[30]; /* definite upper limit for SRU params */
char *uri_args;
+ z_HTTP_header_add_basic_auth(encode, &hreq->headers,
+ srw_pdu->username, srw_pdu->password);
if (yaz_get_sru_parms(srw_pdu, encode, name, value))
return -1;
};
Z_SOAP *p = (Z_SOAP*) odr_malloc(odr, sizeof(*p));
+ z_HTTP_header_add_basic_auth(odr, &hreq->headers,
+ srw_pdu->username, srw_pdu->password);
z_HTTP_header_add_content_type(odr,
&hreq->headers,
"text/xml", charset);