X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fzoom-sru.c;h=0776057ef831574e145d3a033a43ad5df3c8274e;hb=e457b1e25f30fde461f1a13b430114a19f119d4e;hp=b997eebf98cdbaa1edf8c29882d49d1c74c7e611;hpb=047d6669724619dd486a9bfa62cde1b909951491;p=yaz-moved-to-github.git diff --git a/src/zoom-sru.c b/src/zoom-sru.c index b997eeb..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 @@ -247,7 +268,7 @@ static zoom_ret handle_srw_response(ZOOM_connection c, NMEM nmem; ZOOM_Event event; int *start, *count; - const char *syntax, *elementSetName; + const char *syntax, *elementSetName, *schema; if (!c->tasks) return zoom_complete; @@ -260,7 +281,7 @@ static zoom_ret handle_srw_response(ZOOM_connection c, count = &c->tasks->u.search.count; syntax = c->tasks->u.search.syntax; elementSetName = c->tasks->u.search.elementSetName; - + schema = c->tasks->u.search.schema; /* Required not for reporting client hit count multiple times into session */ if (!c->tasks->u.search.recv_search_fired) { yaz_log(YLOG_DEBUG, "posting ZOOM_EVENT_RECV_SEARCH"); @@ -277,6 +298,7 @@ static zoom_ret handle_srw_response(ZOOM_connection c, count = &c->tasks->u.retrieve.count; syntax = c->tasks->u.retrieve.syntax; elementSetName = c->tasks->u.retrieve.elementSetName; + schema = c->tasks->u.retrieve.schema; break; default: return zoom_complete; @@ -346,7 +368,7 @@ static zoom_ret handle_srw_response(ZOOM_connection c, resultset->odr); } ZOOM_record_cache_add(resultset, npr, pos, syntax, elementSetName, - sru_rec->recordSchema, diag); + schema, diag); } *count -= i; *start += i;