X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fzoom-sru.c;h=f688749e3c2e86de8955b769b78a39efc8a7d95d;hp=b3c34cb754909b5de2110cf6e1bd33b402ef418f;hb=e746aded3630be444c66f12e341a63413df92371;hpb=612ac7d30003582e44d4184c830eee7f1a1a0443 diff --git a/src/zoom-sru.c b/src/zoom-sru.c index b3c34cb..f688749 100644 --- a/src/zoom-sru.c +++ b/src/zoom-sru.c @@ -62,8 +62,29 @@ static zoom_ret send_srw(ZOOM_connection c, Z_SRW_PDU *sr) static Z_SRW_PDU *ZOOM_srw_get_pdu(ZOOM_connection c, int type) { Z_SRW_PDU *sr = yaz_srw_get_pdu(c->odr_out, type, c->sru_version); - sr->username = c->user; - sr->password = c->password; + if (c->url_authentication && c->user) + { + Z_SRW_extra_arg **ea = &sr->extra_args; + while (*ea) + ea = &(*ea)->next; + *ea = (Z_SRW_extra_arg *) odr_malloc(c->odr_out, sizeof(**ea)); + (*ea)->name = "x-username"; + (*ea)->value = c->user; + ea = &(*ea)->next; + if (c->password) + { + *ea = (Z_SRW_extra_arg *) odr_malloc(c->odr_out, sizeof(**ea)); + (*ea)->name = "x-password"; + (*ea)->value = c->password; + ea = &(*ea)->next; + } + *ea = 0; + } + else + { + sr->username = c->user; + sr->password = c->password; + } return sr; } #endif @@ -414,9 +435,10 @@ int ZOOM_handle_sru(ZOOM_connection c, Z_HTTP_Response *hres, { Z_SOAP *soap_package = 0; ODR o = c->odr_in; - Z_SOAP_Handler soap_handlers[3] = { + Z_SOAP_Handler soap_handlers[4] = { {YAZ_XMLNS_SRU_v1_response, 0, (Z_SOAP_fun) yaz_srw_codec}, {YAZ_XMLNS_SRU_v2_mask, 0, (Z_SOAP_fun) yaz_srw_codec}, + {"searchRetrieveResponse", 0, (Z_SOAP_fun) yaz_srw_codec}, {0, 0, 0} }; ret = z_soap_codec(o, &soap_package,