X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fhttp_command.c;h=badb77bf850c723660bfd66d81fd273ba6314342;hb=8979547d2f3be2c18f640f3569bd14e778d54de1;hp=37ad0bc64c27134c7a46db7f64803c6ad6f4d17c;hpb=83518ddb5165d783b37a0244bb0f3c79cd1b8398;p=pazpar2-moved-to-github.git
diff --git a/src/http_command.c b/src/http_command.c
index 37ad0bc..badb77b 100644
--- a/src/http_command.c
+++ b/src/http_command.c
@@ -1,5 +1,5 @@
/* This file is part of Pazpar2.
- Copyright (C) 2006-2009 Index Data
+ Copyright (C) 2006-2010 Index Data
Pazpar2 is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
@@ -379,7 +379,8 @@ static void targets_termlist(WRBUF wrbuf, struct session *se, int num,
wrbuf_xmlputs(wrbuf, ht[i].name);
wrbuf_puts(wrbuf, "\n");
- wrbuf_printf(wrbuf, "%d\n", ht[i].hits);
+ wrbuf_printf(wrbuf, "" ODR_INT_PRINTF "\n",
+ ht[i].hits);
wrbuf_puts(wrbuf, "");
wrbuf_xmlputs(wrbuf, ht[i].state);
@@ -472,6 +473,7 @@ static void cmd_bytarget(struct http_channel *c)
struct http_request *rq = c->request;
struct http_session *s = locate_session(rq, rs);
struct hitsbytarget *ht;
+ const char *settings = http_argbyname(rq, "settings");
int count, i;
if (!s)
@@ -495,15 +497,21 @@ static void cmd_bytarget(struct http_channel *c)
wrbuf_puts(c->wrbuf, "\n");
}
- wrbuf_printf(c->wrbuf, "%d\n", ht[i].hits);
+ wrbuf_printf(c->wrbuf, "" ODR_INT_PRINTF "\n", ht[i].hits);
wrbuf_printf(c->wrbuf, "%d\n", ht[i].diagnostic);
wrbuf_printf(c->wrbuf, "%d\n", ht[i].records);
wrbuf_puts(c->wrbuf, "");
wrbuf_xmlputs(c->wrbuf, ht[i].state);
wrbuf_puts(c->wrbuf, "\n");
-
+ if (settings && *settings == '1')
+ {
+ wrbuf_puts(c->wrbuf, "\n");
+ wrbuf_puts(c->wrbuf, wrbuf_cstr(ht[i].settings_xml));
+ wrbuf_puts(c->wrbuf, "\n");
+ }
wrbuf_puts(c->wrbuf, "");
+ wrbuf_destroy(ht[i].settings_xml);
}
wrbuf_puts(c->wrbuf, "");
@@ -524,8 +532,16 @@ static void write_metadata(WRBUF w, struct conf_service *service,
continue;
for (md = ml[imeta]; md; md = md->next)
{
- wrbuf_printf(w, "\n", cmd->name);
+ struct record_metadata_attr *attr = md->attributes;
+ wrbuf_printf(w, "\nname);
+ for (; attr; attr = attr->next)
+ {
+ wrbuf_printf(w, " %s=\"", attr->name);
+ wrbuf_xmlputs(w, attr->value);
+ wrbuf_puts(w, "\"");
+ }
+ wrbuf_puts(w, ">");
switch (cmd->type)
{
case Metadata_type_generic:
@@ -732,7 +748,7 @@ static void show_records(struct http_channel *c, int active)
int startn = 0;
int numn = 20;
int total;
- int total_hits;
+ Odr_int total_hits;
int i;
if (!s)
@@ -760,7 +776,7 @@ static void show_records(struct http_channel *c, int active)
wrbuf_puts(c->wrbuf, HTTP_COMMAND_RESPONSE_PREFIX "\nOK\n");
wrbuf_printf(c->wrbuf, "%d\n", active);
wrbuf_printf(c->wrbuf, "%d\n", total);
- wrbuf_printf(c->wrbuf, "%d\n", total_hits);
+ wrbuf_printf(c->wrbuf, "" ODR_INT_PRINTF "\n", total_hits);
wrbuf_printf(c->wrbuf, "%d\n", startn);
wrbuf_printf(c->wrbuf, "%d\n", numn);
@@ -921,7 +937,7 @@ static void cmd_stat(struct http_channel *c)
wrbuf_rewind(c->wrbuf);
wrbuf_puts(c->wrbuf, HTTP_COMMAND_RESPONSE_PREFIX "");
wrbuf_printf(c->wrbuf, "%d\n", clients);
- wrbuf_printf(c->wrbuf, "%d\n", stat.num_hits);
+ wrbuf_printf(c->wrbuf, "" ODR_INT_PRINTF "\n", stat.num_hits);
wrbuf_printf(c->wrbuf, "%d\n", stat.num_records);
wrbuf_printf(c->wrbuf, "%d\n", stat.num_clients);
wrbuf_printf(c->wrbuf, "%d\n", stat.num_no_connection);