X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=src%2Fhttp_command.c;h=7c23404aac6f1ab81f1d4c2fa48ac3aae583b44e;hb=cea5d06318c86c9652cad5c4fefa39fa2e9745ac;hp=64331a468c23adc3455413784a3674d02fa323ca;hpb=817e3ec506c4095bc4fcc1923cee36153ef4ee43;p=pazpar2-moved-to-github.git
diff --git a/src/http_command.c b/src/http_command.c
index 64331a4..7c23404 100644
--- a/src/http_command.c
+++ b/src/http_command.c
@@ -401,6 +401,7 @@ static int process_settings(struct session *se, struct http_request *rq,
struct http_response *rs)
{
struct http_argument *a;
+ NMEM nmem = nmem_create();
for (a = rq->arguments; a; a = a->next)
if (strchr(a->name, '['))
@@ -411,17 +412,18 @@ static int process_settings(struct session *se, struct http_request *rq,
char *setting;
// Nmem_strsplit *rules*!!!
- nmem_strsplit(se->session_nmem, "[]", a->name, &res, &num);
+ nmem_strsplit(nmem, "[]", a->name, &res, &num);
if (num != 2)
{
error(rs, PAZPAR2_MALFORMED_SETTING, a->name);
+ nmem_destroy(nmem);
return -1;
}
setting = res[0];
dbname = res[1];
- session_apply_setting(se, dbname, setting,
- nmem_strdup(se->session_nmem, a->value));
+ session_apply_setting(se, dbname, setting, a->value);
}
+ nmem_destroy(nmem);
return 0;
}
@@ -507,9 +509,7 @@ static void apply_local_setting(void *client_data,
{
struct session *se = (struct session *) client_data;
- session_apply_setting(se, nmem_strdup(se->session_nmem, set->target),
- nmem_strdup(se->session_nmem, set->name),
- nmem_strdup(se->session_nmem, set->value));
+ session_apply_setting(se, set->target, set->name, set->value);
}
static void cmd_settings(struct http_channel *c)
@@ -788,9 +788,9 @@ static void bytarget_response(struct http_channel *c, struct http_session *s,
wrbuf_printf(c->wrbuf, "%d\n",
ht[i].records - ht[i].filtered);
+ wrbuf_printf(c->wrbuf, "%d\n", ht[i].filtered);
if (version >= 2)
{
- wrbuf_printf(c->wrbuf, "%d\n", ht[i].filtered);
wrbuf_printf(c->wrbuf, "" ODR_INT_PRINTF
"\n", ht[i].approximation);
}
@@ -1457,6 +1457,17 @@ static void cmd_stat(struct http_channel *c)
release_session(c, s);
}
+static void cmd_stop(struct http_channel *c)
+{
+ struct http_session *s = locate_session(c);
+ if (!s)
+ return;
+ response_open_ok(c, "stop");
+ session_stop(s->psession);
+ response_close(c, "stop");
+ release_session(c, s);
+}
+
static void cmd_info(struct http_channel *c)
{
char yaz_version_str[20];
@@ -1516,6 +1527,7 @@ struct {
{ "ping", cmd_ping },
{ "record", cmd_record },
{ "info", cmd_info },
+ { "stop", cmd_stop },
{0,0}
};