X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fzoom-sru.c;fp=src%2Fzoom-sru.c;h=0776057ef831574e145d3a033a43ad5df3c8274e;hp=b8297386ec2c618e494cf78d5074fb862d54eda1;hb=c23b3002b19ba3fcc016eb3fab454f22e0ecacee;hpb=decbbc7c15f7c05fae05f6bcb4e677caf77959da diff --git a/src/zoom-sru.c b/src/zoom-sru.c index b829738..0776057 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