/*
- * $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 <stdio.h>
#include <yaz/yaz-util.h>
+#include "config.h"
#include "util.h"
#include "eventl.h"
#include "pazpar2.h"
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, "<info>\n");
+ wrbuf_printf(c->wrbuf, " <version>\n");
+ wrbuf_printf(c->wrbuf, " <pazpar2>%s</pazpar2>\n", VERSION);
+
+ yaz_version(yaz_version_str, 0);
+ wrbuf_printf(c->wrbuf, " <yaz compiled=\"%s\">%s</yaz>\n",
+ YAZ_VERSION, yaz_version_str);
+ wrbuf_printf(c->wrbuf, " </version>\n");
+
+ wrbuf_puts(c->wrbuf, "</info>");
+ rs->payload = nmem_strdup(c->nmem, wrbuf_buf(c->wrbuf));
+ http_send_response(c);
+}
struct {
char *name;
{ "exit", cmd_exit },
{ "ping", cmd_ping },
{ "record", cmd_record },
+ { "info", cmd_info },
{0,0}
};
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);