Fix compilation without Libxml2 (broke in 4.2.0)
[yaz-moved-to-github.git] / src / srwutil.c
index 353286f..242ba16 100644 (file)
@@ -36,7 +36,7 @@ char *yaz_encode_sru_dbpath_odr(ODR out, const char *db)
     return dst;
 }
 
-Z_AttributeList *yaz_use_atttribute_create(ODR o, const char *name) {
+Z_AttributeList *yaz_use_attribute_create(ODR o, const char *name) {
     Z_AttributeList *attributes= (Z_AttributeList *) odr_malloc(o, sizeof(*attributes));
     Z_AttributeElement ** elements;
     attributes->num_attributes = 1;
@@ -79,7 +79,7 @@ const char *yaz_element_attribute_value_get(xmlNodePtr ptr, const char *node_nam
         }
     return 0;
 }
-
+#endif
 
 static int yaz_base64decode(const char *in, char *out)
 {
@@ -126,7 +126,6 @@ static int yaz_base64decode(const char *in, char *out)
     *out = '\0';
     return olen;
 }
-#endif
 
 int yaz_srw_check_content_type(Z_HTTP_Response *hres)
 {
@@ -146,7 +145,6 @@ int yaz_srw_check_content_type(Z_HTTP_Response *hres)
  * Look for authentication tokens in HTTP Basic parameters or in x-username/x-password
  * parameters. Added by SH.
  */
-#if YAZ_HAVE_XML2
 static void yaz_srw_decodeauth(Z_SRW_PDU *sr, Z_HTTP_Request *hreq,
                                char *username, char *password, ODR decode)
 {
@@ -181,7 +179,6 @@ static void yaz_srw_decodeauth(Z_SRW_PDU *sr, Z_HTTP_Request *hreq,
             sr->password = odr_strdup(decode, pbuf);
     }
 }
-#endif
 
 void yaz_uri_val_int(const char *path, const char *name, ODR o, Odr_int **intp)
 {
@@ -335,6 +332,7 @@ int yaz_srw_decode(Z_HTTP_Request *hreq, Z_SRW_PDU **srw_pdu,
             if (ret == 0 && (*soap_package)->which == Z_SOAP_generic)
             {
                 *srw_pdu = (Z_SRW_PDU*) (*soap_package)->u.generic->p;
+                yaz_srw_decodeauth(*srw_pdu, hreq, 0, 0, decode);
                 
                 if ((*srw_pdu)->which == Z_SRW_searchRetrieve_request &&
                     (*srw_pdu)->u.request->database == 0)