X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Fhttp_command.c;h=848370571eeaa1a844d8d8df2c5e7050b4bc923f;hb=bdde87cfaf2307da5d3f6fcb911f621a9df114fe;hp=4598013d89e3496fa6357f05275b1bb20a72353c;hpb=0900da0f443362be1efd1a59d2aae7c227487099;p=pazpar2-moved-to-github.git diff --git a/src/http_command.c b/src/http_command.c index 4598013..8483705 100644 --- a/src/http_command.c +++ b/src/http_command.c @@ -1,5 +1,5 @@ /* - * $Id: http_command.c,v 1.16 2007-01-10 10:17:50 adam Exp $ + * $Id: http_command.c,v 1.21 2007-01-12 23:41:35 quinn Exp $ */ #include @@ -17,6 +17,7 @@ #include +#include "config.h" #include "util.h" #include "eventl.h" #include "pazpar2.h" @@ -498,6 +499,26 @@ static void cmd_stat(struct http_channel *c) http_send_response(c); } +static void cmd_info(struct http_channel *c) +{ + char yaz_version_str[20]; + struct http_request *rq = c->request; + struct http_response *rs = c->response; + + wrbuf_rewind(c->wrbuf); + wrbuf_puts(c->wrbuf, "\n"); + wrbuf_printf(c->wrbuf, " \n"); + wrbuf_printf(c->wrbuf, " %s\n", VERSION); + + yaz_version(yaz_version_str, 0); + wrbuf_printf(c->wrbuf, " %s\n", + YAZ_VERSION, yaz_version_str); + wrbuf_printf(c->wrbuf, " \n"); + + wrbuf_puts(c->wrbuf, ""); + rs->payload = nmem_strdup(c->nmem, wrbuf_buf(c->wrbuf)); + http_send_response(c); +} struct { char *name; @@ -512,6 +533,7 @@ struct { { "exit", cmd_exit }, { "ping", cmd_ping }, { "record", cmd_record }, + { "info", cmd_info }, {0,0} }; @@ -522,6 +544,10 @@ void http_command(struct http_channel *c) int i; c->response = rs; + + http_addheader(rs, "Expires", "Thu, 19 Nov 1981 08:52:00 GMT"); + http_addheader(rs, "Cache-Control", "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); + if (!command) { error(rs, "417", "Must supply command", 0);