projects
/
pazpar2-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into paz-927
[pazpar2-moved-to-github.git]
/
src
/
http_command.c
diff --git
a/src/http_command.c
b/src/http_command.c
index
64331a4
..
7c23404
100644
(file)
--- 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;
struct http_response *rs)
{
struct http_argument *a;
+ NMEM nmem = nmem_create();
for (a = rq->arguments; a; a = a->next)
if (strchr(a->name, '['))
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*!!!
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);
if (num != 2)
{
error(rs, PAZPAR2_MALFORMED_SETTING, a->name);
+ nmem_destroy(nmem);
return -1;
}
setting = res[0];
dbname = res[1];
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;
}
return 0;
}
@@
-507,9
+509,7
@@
static void apply_local_setting(void *client_data,
{
struct session *se = (struct session *) 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)
}
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, "<records>%d</records>\n",
ht[i].records - ht[i].filtered);
wrbuf_printf(c->wrbuf, "<records>%d</records>\n",
ht[i].records - ht[i].filtered);
+ wrbuf_printf(c->wrbuf, "<filtered>%d</filtered>\n", ht[i].filtered);
if (version >= 2)
{
if (version >= 2)
{
- wrbuf_printf(c->wrbuf, "<filtered>%d</filtered>\n", ht[i].filtered);
wrbuf_printf(c->wrbuf, "<approximation>" ODR_INT_PRINTF
"</approximation>\n", ht[i].approximation);
}
wrbuf_printf(c->wrbuf, "<approximation>" ODR_INT_PRINTF
"</approximation>\n", ht[i].approximation);
}
@@
-1457,6
+1457,17
@@
static void cmd_stat(struct http_channel *c)
release_session(c, s);
}
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];
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 },
{ "ping", cmd_ping },
{ "record", cmd_record },
{ "info", cmd_info },
+ { "stop", cmd_stop },
{0,0}
};
{0,0}
};