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
XSL files now in sync with future 1.7 series
[pazpar2-moved-to-github.git]
/
src
/
http_command.c
diff --git
a/src/http_command.c
b/src/http_command.c
index
30de3d8
..
64331a4
100644
(file)
--- a/
src/http_command.c
+++ b/
src/http_command.c
@@
-1,5
+1,5
@@
/* This file is part of Pazpar2.
/* This file is part of Pazpar2.
- Copyright (C) 2006-2013 Index Data
+ Copyright (C) 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
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
@@
-263,9
+263,9
@@
static const char *get_msg(enum pazpar2_error_code code)
return "No error";
}
return "No error";
}
-static void error(struct http_response *rs,
- enum pazpar2_error_code code,
- const char *addinfo)
+static void error2(struct http_response *rs,
+ enum pazpar2_error_code code,
+ const char *addinfo, const char *addinfo2)
{
struct http_channel *c = rs->channel;
WRBUF text = wrbuf_alloc();
{
struct http_channel *c = rs->channel;
WRBUF text = wrbuf_alloc();
@@
-278,7
+278,14
@@
static void error(struct http_response *rs,
wrbuf_printf(text, HTTP_COMMAND_RESPONSE_PREFIX
"<error code=\"%d\" msg=\"%s\">", (int) code, msg);
if (addinfo)
wrbuf_printf(text, HTTP_COMMAND_RESPONSE_PREFIX
"<error code=\"%d\" msg=\"%s\">", (int) code, msg);
if (addinfo)
+ {
wrbuf_xmlputs(text, addinfo);
wrbuf_xmlputs(text, addinfo);
+ if (addinfo2)
+ {
+ wrbuf_xmlputs(text, ": ");
+ wrbuf_xmlputs(text, addinfo2);
+ }
+ }
wrbuf_puts(text, "</error>");
yaz_log(YLOG_WARN, "HTTP %s %s%s%s", http_status,
wrbuf_puts(text, "</error>");
yaz_log(YLOG_WARN, "HTTP %s %s%s%s", http_status,
@@
-288,6
+295,13
@@
static void error(struct http_response *rs,
http_send_response(c);
}
http_send_response(c);
}
+static void error(struct http_response *rs,
+ enum pazpar2_error_code code,
+ const char *addinfo)
+{
+ error2(rs, code, addinfo, 0);
+}
+
static void response_open_command(struct http_channel *c, const char *command)
{
wrbuf_rewind(c->wrbuf);
static void response_open_command(struct http_channel *c, const char *command)
{
wrbuf_rewind(c->wrbuf);
@@
-911,6
+925,9
@@
static void write_metadata(WRBUF w, struct conf_service *service,
if (md->data.number.min != md->data.number.max)
wrbuf_printf(w, "-%d", md->data.number.max);
break;
if (md->data.number.min != md->data.number.max)
wrbuf_printf(w, "-%d", md->data.number.max);
break;
+ case Metadata_type_float:
+ wrbuf_printf(w, "%f", md->data.fnumber);
+ break;
default:
wrbuf_puts(w, "[can't represent]");
break;
default:
wrbuf_puts(w, "[can't represent]");
break;
@@
-1271,7
+1288,7
@@
static void cmd_show(struct http_channel *c)
status = session_active_clients(s->psession);
status = session_active_clients(s->psession);
- if (block)
+ if (block && reclist_get_num_records(s->psession->reclist) == 0)
{
if (!strcmp(block, "preferred")
&& !session_is_preferred_clients_ready(s->psession)
{
if (!strcmp(block, "preferred")
&& !session_is_preferred_clients_ready(s->psession)
@@
-1361,6
+1378,7
@@
static void cmd_search(struct http_channel *c)
const char *rank = http_argbyname(rq, "rank");
enum pazpar2_error_code code;
const char *addinfo = 0;
const char *rank = http_argbyname(rq, "rank");
enum pazpar2_error_code code;
const char *addinfo = 0;
+ const char *addinfo2 = 0;
struct reclist_sortparms *sp;
struct conf_service *service = 0;
struct reclist_sortparms *sp;
struct conf_service *service = 0;
@@
-1391,10
+1409,10
@@
static void cmd_search(struct http_channel *c)
}
code = session_search(s->psession, query, startrecs, maxrecs, filter, limit,
}
code = session_search(s->psession, query, startrecs, maxrecs, filter, limit,
- &addinfo, sp, mergekey, rank);
+ &addinfo, &addinfo2, sp, mergekey, rank);
if (code)
{
if (code)
{
- error(rs, code, addinfo);
+ error2(rs, code, addinfo, addinfo2);
release_session(c, s);
return;
}
release_session(c, s);
return;
}