X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=server%2Fseshigh.c;h=b19cc62539e10d5d1505617a29e52caaa6b21d02;hp=a6a9a132cbe8f264dbc3cf7a9065da8336928491;hb=d9d97a04b6f9597225b8440dad61790dfa39a751;hpb=6011a7156d007b94abde4bfc3d427a1bd853cd86 diff --git a/server/seshigh.c b/server/seshigh.c index a6a9a13..b19cc62 100644 --- a/server/seshigh.c +++ b/server/seshigh.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2003, Index Data * See the file LICENSE for details. * - * $Id: seshigh.c,v 1.135 2003-02-14 18:49:24 adam Exp $ + * $Id: seshigh.c,v 1.136 2003-02-17 14:35:42 adam Exp $ */ /* @@ -502,7 +502,9 @@ static void srw_bend_fetch(association *assoc, int pos, record->recordData_buf = rr.record; record->recordData_len = rr.len; record->recordPosition = odr_intdup(o, pos); - record->recordSchema = odr_strdup(o, srw_req->recordSchema); + record->recordSchema = 0; + if (srw_req->recordSchema) + record->recordSchema = odr_strdup(o, srw_req->recordSchema); } } @@ -520,7 +522,7 @@ static void srw_bend_search(association *assoc, request *req, rr.setname = "default"; rr.replace_set = 1; rr.num_bases = 1; - rr.basenames = &base; + rr.basenames = &srw_req->database; rr.referenceId = 0; ext = (Z_External *) odr_malloc(assoc->decode, sizeof(*ext)); @@ -548,6 +550,7 @@ static void srw_bend_search(association *assoc, request *req, rr.errcode = 0; rr.errstring = 0; rr.search_info = 0; + yaz_log_zquery(rr.query); (assoc->init->bend_search)(assoc->backend, &rr); srw_res->numberOfRecords = odr_intdup(assoc->encode, rr.hits); if (rr.errcode) @@ -557,6 +560,7 @@ static void srw_bend_search(association *assoc, request *req, odr_malloc(assoc->encode, sizeof(*srw_res->diagnostics)); srw_res->diagnostics[0].code = odr_intdup(assoc->encode, rr.errcode); + srw_res->diagnostics[0].details = rr.errstring; } else { @@ -721,8 +725,27 @@ static void process_http_request(association *assoc, request *req) Z_SRW_searchRetrieve *res = yaz_srw_get(assoc->encode, Z_SRW_searchRetrieve_response); - - srw_bend_search(assoc, req, sr->u.request, res->u.response); + + if (!sr->u.request->database) + { + const char *p0 = hreq->path, *p1; + if (*p0 == '/') + p0++; + p1 = strchr(p0, '?'); + if (!p1) + p1 = p0 + strlen(p0); + if (p1 != p0) + { + sr->u.request->database = + odr_malloc(assoc->decode, p1 - p0 + 1); + memcpy (sr->u.request->database, p0, p1 - p0); + sr->u.request->database[p1 - p0] = '\0'; + } + else + sr->u.request->database = "Default"; + } + srw_bend_search(assoc, req, sr->u.request, + res->u.response); soap_package->u.generic->p = res; http_code = 200; @@ -735,6 +758,7 @@ static void process_http_request(association *assoc, request *req) &hres->content_buf, &hres->content_len, soap_handlers); hres->code = http_code; + z_HTTP_header_add(o, &hres->headers, "Content-Type", "text/xml"); } #endif if (!p) /* still no response ? */