From 4e641034b013c43b20922f66258f5daf8ac3ce59 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 10 Feb 2010 10:42:15 +0100 Subject: [PATCH] yaz-client's auth command also works for SRU Until now the auth command and option -u would only work for Z39.50. --- client/client.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/client/client.c b/client/client.c index 9717d29..09c9a85 100644 --- a/client/client.c +++ b/client/client.c @@ -1200,6 +1200,25 @@ static int send_srw(Z_SRW_PDU *sr) gdu = z_get_HTTP_Request_host_path(out, host_port, path); + if (auth) + { + if (auth->which == Z_IdAuthentication_open) + { + char **darray; + int num; + nmem_strsplit(out->mem, "/", auth->u.open, &darray, &num); + if (num >= 1) + sr->username = darray[0]; + if (num >= 2) + sr->password = darray[1]; + } + else if (auth->which == Z_IdAuthentication_idPass) + { + sr->username = auth->u.idPass->userId; + sr->password = auth->u.idPass->password; + } + } + if (!yaz_matchstr(sru_method, "get")) { yaz_sru_get_encode(gdu->u.HTTP_Request, sr, out, charset); -- 1.7.10.4