From: Adam Dickmeiss Date: Tue, 26 Jan 2010 12:09:57 +0000 (+0100) Subject: Extend init resp to include server ID, bug #3231 X-Git-Tag: v1.4.0~164 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=1b761ca7a958b482d899a70a8591ffcc1f42026f;p=pazpar2-moved-to-github.git Extend init resp to include server ID, bug #3231 --- diff --git a/src/http_command.c b/src/http_command.c index e3981b2..e3a290f 100644 --- a/src/http_command.c +++ b/src/http_command.c @@ -297,8 +297,16 @@ static void cmd_init(struct http_channel *c) s->session_id = sesid; if (process_settings(s->psession, c->request, c->response) < 0) return; - sprintf(buf, HTTP_COMMAND_RESPONSE_PREFIX "OK%u" - "" PAZPAR2_PROTOCOL_VERSION "", sesid); + + sprintf(buf, HTTP_COMMAND_RESPONSE_PREFIX + "OK%u", sesid); + if (c->server->server_id) + { + strcat(buf, "."); + strcat(buf, c->server->server_id); + } + strcat(buf, "" + "" PAZPAR2_PROTOCOL_VERSION ""); rs->payload = nmem_strdup(c->nmem, buf); http_send_response(c); } diff --git a/src/pazpar2_config.c b/src/pazpar2_config.c index 62e57f8..0771c2c 100644 --- a/src/pazpar2_config.c +++ b/src/pazpar2_config.c @@ -722,6 +722,12 @@ static struct conf_server *server_create(struct conf_config *config, server->mergekey_pct = 0; server->server_settings = 0; + xmlChar *server_id = xmlGetProp(node, (xmlChar *) "id"); + if (server_id) + server->server_id = nmem_strdup(nmem, (const char *)server_id); + else + server->server_id = 0; + for (n = node->children; n; n = n->next) { if (n->type != XML_ELEMENT_NODE) diff --git a/src/pazpar2_config.h b/src/pazpar2_config.h index 65ea5cc..9b57167 100644 --- a/src/pazpar2_config.h +++ b/src/pazpar2_config.h @@ -135,6 +135,7 @@ struct conf_server struct sockaddr_in *proxy_addr; int listener_socket; char *server_settings; + char *server_id; pp2_charset_t relevance_pct; pp2_charset_t sort_pct;