X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fhttp_command.c;h=84fac1282eafcf88b76b7c9e2fcba4770ba9ffc3;hb=27b510020a28c83feb607998371d824284fc24de;hp=5f40d29480c6b96229cb1c87862392d8c7bee3e8;hpb=6576c41731395b1fe85ede4556892c3034960592;p=pazpar2-moved-to-github.git diff --git a/src/http_command.c b/src/http_command.c index 5f40d29..84fac12 100644 --- a/src/http_command.c +++ b/src/http_command.c @@ -470,6 +470,8 @@ static void cmd_init(struct http_channel *c) wrbuf_puts(c->wrbuf, "" "" PAZPAR2_PROTOCOL_VERSION ""); + wrbuf_printf(c->wrbuf, "%d\n", 1000 * ((s->psession->service->session_timeout >= 20) ? + (s->psession->service->session_timeout - 10) : 50)); response_close(c, "init"); } @@ -498,6 +500,7 @@ static void cmd_settings(struct http_channel *c) { xmlDoc *doc = xmlParseMemory(rq->content_buf, rq->content_len); xmlNode *root_n; + int ret; if (!doc) { error(rs, PAZPAR2_MALFORMED_SETTING, 0); @@ -505,10 +508,14 @@ static void cmd_settings(struct http_channel *c) return; } root_n = xmlDocGetRootElement(doc); - - settings_read_node_x(root_n, s->psession, apply_local_setting); - + ret = settings_read_node_x(root_n, s->psession, apply_local_setting); xmlFreeDoc(doc); + if (ret) + { + error(rs, PAZPAR2_MALFORMED_SETTING, 0); + release_session(c,s); + return; + } } if (process_settings(s->psession, rq, rs) < 0) { @@ -726,8 +733,10 @@ static void bytarget_response(struct http_channel *c, struct http_session *s, co } wrbuf_printf(c->wrbuf, "%d\n", ht[i].records - ht[i].filtered); - if (version >= 2) + if (version >= 2) { wrbuf_printf(c->wrbuf, "%d\n", ht[i].filtered); + wrbuf_printf(c->wrbuf, "" ODR_INT_PRINTF "\n", ht[i].approximation); + } wrbuf_puts(c->wrbuf, ""); wrbuf_xmlputs(c->wrbuf, ht[i].state); wrbuf_puts(c->wrbuf, "\n");