X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fhttp_command.c;h=223903dfdabf9e947863a7d080b3a1e231eaeaca;hb=8acdfb7a90bd20104f67a2b1dfc9023c54473422;hp=40a9a28cc92eac94b8de850b2b0779302cbb830e;hpb=bf7d0afdd97bd8cb1ae2d560d40fe4d84b96ef48;p=pazpar2-moved-to-github.git diff --git a/src/http_command.c b/src/http_command.c index 40a9a28..223903d 100644 --- a/src/http_command.c +++ b/src/http_command.c @@ -1,5 +1,5 @@ /* - * $Id: http_command.c,v 1.25 2007-01-18 16:21:23 quinn Exp $ + * $Id: http_command.c,v 1.28 2007-03-20 07:27:51 adam Exp $ */ #include @@ -168,7 +168,8 @@ static void targets_termlist(WRBUF wrbuf, struct session *se, int num) for (i = 0; i < count && i < num && ht[i].hits > 0; i++) { wrbuf_puts(wrbuf, "\n\n"); - wrbuf_printf(wrbuf, "%s\n", ht[i].id); + wrbuf_printf(wrbuf, "%s\n", ht[i].id); + wrbuf_printf(wrbuf, "%s\n", ht[i].name); wrbuf_printf(wrbuf, "%d\n", ht[i].hits); wrbuf_printf(wrbuf, "%s\n", ht[i].state); wrbuf_printf(wrbuf, "%d\n", ht[i].diagnostic); @@ -236,7 +237,7 @@ static void cmd_termlist(struct http_channel *c) name++; } wrbuf_puts(c->wrbuf, ""); - rs->payload = nmem_strdup(rq->channel->nmem, wrbuf_buf(c->wrbuf)); + rs->payload = nmem_strdup(rq->channel->nmem, wrbuf_cstr(c->wrbuf)); http_send_response(c); } @@ -271,7 +272,7 @@ static void cmd_bytarget(struct http_channel *c) } wrbuf_puts(c->wrbuf, ""); - rs->payload = nmem_strdup(c->nmem, wrbuf_buf(c->wrbuf)); + rs->payload = nmem_strdup(c->nmem, wrbuf_cstr(c->wrbuf)); http_send_response(c); } @@ -309,7 +310,9 @@ static void write_metadata(WRBUF w, struct conf_service *service, static void write_subrecord(struct record *r, WRBUF w, struct conf_service *service) { - wrbuf_printf(w, "\n", r->client->database->url); + wrbuf_printf(w, "\n", + r->client->database->url, + r->client->database->name ? r->client->database->name : ""); write_metadata(w, service, r->metadata, 1); wrbuf_puts(w, "\n"); } @@ -345,7 +348,7 @@ static void cmd_record(struct http_channel *c) for (r = rec->records; r; r = r->next) write_subrecord(r, c->wrbuf, service); wrbuf_puts(c->wrbuf, "\n"); - rs->payload = nmem_strdup(c->nmem, wrbuf_buf(c->wrbuf)); + rs->payload = nmem_strdup(c->nmem, wrbuf_cstr(c->wrbuf)); http_send_response(c); } @@ -412,7 +415,7 @@ static void show_records(struct http_channel *c, int active) } wrbuf_puts(c->wrbuf, "\n"); - rs->payload = nmem_strdup(c->nmem, wrbuf_buf(c->wrbuf)); + rs->payload = nmem_strdup(c->nmem, wrbuf_cstr(c->wrbuf)); http_send_response(c); } @@ -466,6 +469,7 @@ static void cmd_search(struct http_channel *c) struct http_response *rs = c->response; struct http_session *s = locate_session(rq, rs); char *query = http_argbyname(rq, "query"); + char *filter = http_argbyname(rq, "filter"); char *res; if (!s) @@ -475,7 +479,7 @@ static void cmd_search(struct http_channel *c) error(rs, "417", "Must supply query", 0); return; } - res = search(s->psession, query); + res = search(s->psession, query, filter); if (res) { error(rs, "417", res, res); @@ -515,7 +519,7 @@ static void cmd_stat(struct http_channel *c) wrbuf_printf(c->wrbuf, "%d\n", stat.num_failed); wrbuf_printf(c->wrbuf, "%d\n", stat.num_error); wrbuf_puts(c->wrbuf, ""); - rs->payload = nmem_strdup(c->nmem, wrbuf_buf(c->wrbuf)); + rs->payload = nmem_strdup(c->nmem, wrbuf_cstr(c->wrbuf)); http_send_response(c); } @@ -535,7 +539,7 @@ static void cmd_info(struct http_channel *c) wrbuf_printf(c->wrbuf, " \n"); wrbuf_puts(c->wrbuf, ""); - rs->payload = nmem_strdup(c->nmem, wrbuf_buf(c->wrbuf)); + rs->payload = nmem_strdup(c->nmem, wrbuf_cstr(c->wrbuf)); http_send_response(c); }