X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fsolr.c;h=088fb63b3480a5fbe5f93485185d7777cfa3219a;hb=1b750a9f8ea0d258fde61f5bac2d5af5bd783eb0;hp=7cfd056e2b0dc01bd071736122ebe6ba38b66b5c;hpb=0380a06a86927164ff17500bcf7c3b54fd5428c4;p=yaz-moved-to-github.git diff --git a/src/solr.c b/src/solr.c index 7cfd056..088fb63 100644 --- a/src/solr.c +++ b/src/solr.c @@ -264,7 +264,6 @@ static int yaz_solr_decode_scan_result(ODR o, xmlNodePtr ptr, Z_SRW_scanResponse *scr) { xmlNodePtr node; - xmlAttr *attr; char *pos; int i = 0; @@ -453,6 +452,7 @@ int yaz_solr_encode_request(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, char *path; char *q; char *pos; + char *cp; int i = 0; z_HTTP_header_add_basic_auth(encode, &hreq->headers, @@ -561,7 +561,17 @@ int yaz_solr_encode_request(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, odr_malloc(encode, strlen(hreq->path) + strlen(uri_args) + strlen(solr_op) + 4); - sprintf(path, "%s/%s?%s", hreq->path, solr_op, uri_args); + strcpy(path, hreq->path); + cp = strrchr(path, '/'); + if (cp) + { + if (!strcmp(cp, "/select") || !strcmp(cp, "/")) + *cp = '\0'; + } + strcat(path, "/"); + strcat(path, solr_op); + strcat(path, "?"); + strcat(path, uri_args); hreq->path = path; z_HTTP_header_add_content_type(encode, &hreq->headers,