- struct connection *co = client_get_connection(cl);
- struct session *se = client_get_session(cl);
- Z_IdAuthentication *idAuth = odr_malloc(global_parameters.odr_out,
- sizeof(*idAuth));
- idAuth->which = Z_IdAuthentication_open;
- idAuth->u.open = auth;
- req->idAuthentication = idAuth;
- connection_set_authentication(co, nmem_strdup(se->session_nmem, auth));
+ client_set_state(cl, Client_Error);
+ yaz_log(YLOG_WARN, "Search error %s (%s): %s",
+ error, addinfo, client_get_url(cl));
+ }
+ else
+ {
+ ZOOM_record rec = 0;
+ const char *msg, *addinfo;
+
+ if (cl->show_raw && cl->show_raw->active)
+ {
+ if ((rec = ZOOM_resultset_record(resultset,
+ cl->show_raw->position-1)))
+ {
+ cl->show_raw->active = 0;
+ ingest_raw_record(cl, rec);
+ }
+ else
+ {
+ yaz_log(YLOG_WARN, "Expected record, but got NULL, offset=%d",
+ cl->show_raw->position-1);
+ }
+ }
+ else
+ {
+ int offset = cl->record_offset;
+ if ((rec = ZOOM_resultset_record(resultset, offset)))
+ {
+ cl->record_offset++;
+ if (cl->session == 0)
+ ;
+ else if (ZOOM_record_error(rec, &msg, &addinfo, 0))
+ {
+ yaz_log(YLOG_WARN, "Record error %s (%s): %s (rec #%d)",
+ msg, addinfo, client_get_url(cl),
+ cl->record_offset);
+ }
+ else
+ {
+ struct session_database *sdb = client_get_database(cl);
+ NMEM nmem = nmem_create();
+ const char *xmlrec;
+ char type[80];
+
+ if (nativesyntax_to_type(sdb, type, rec))
+ yaz_log(YLOG_WARN, "Failed to determine record type");
+ xmlrec = ZOOM_record_get(rec, type, NULL);
+ if (!xmlrec)
+ yaz_log(YLOG_WARN, "ZOOM_record_get failed from %s",
+ client_get_url(cl));
+ else
+ {
+ if (ingest_record(cl, xmlrec, cl->record_offset, nmem))
+ yaz_log(YLOG_WARN, "Failed to ingest from %s",
+ client_get_url(cl));
+ }
+ nmem_destroy(nmem);
+ }
+ }
+ else
+ {
+ yaz_log(YLOG_WARN, "Expected record, but got NULL, offset=%d",
+ offset);
+ }
+ }