X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fsolr.c;h=4ae57bbb732e746ddc883348b95e36bebcc18432;hp=4c77e6fb53920a39c2be216dcc7f34d713bc63dc;hb=7adfe1c2e69ddf39a4f26c015171168a1a8f0ee4;hpb=473824797f568578dc17d7242551cb2f7ccef46c diff --git a/src/solr.c b/src/solr.c index 4c77e6f..4ae57bb 100644 --- a/src/solr.c +++ b/src/solr.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "sru-p.h" @@ -482,6 +483,7 @@ int yaz_solr_encode_request(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, char *q; char *pos; char *cp; + const char *path_args = 0; int i = 0; z_HTTP_header_add_basic_auth(encode, &hreq->headers, @@ -580,8 +582,17 @@ int yaz_solr_encode_request(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, path = (char *) odr_malloc(encode, strlen(hreq->path) + - strlen(uri_args) + strlen(solr_op) + 4); + strlen(uri_args) + strlen(solr_op) + 5); + cp = strchr(hreq->path, '#'); + if (cp) + *cp = '\0'; + cp = strchr(hreq->path, '?'); + if (cp) + { + *cp = '\0'; /* args in path */ + path_args = cp + 1; + } strcpy(path, hreq->path); cp = strrchr(path, '/'); if (cp) @@ -592,6 +603,11 @@ int yaz_solr_encode_request(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, strcat(path, "/"); strcat(path, solr_op); strcat(path, "?"); + if (path_args) + { + strcat(path, path_args); + strcat(path, "&"); + } strcat(path, uri_args); hreq->path = path;