X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Fhttp_command.c;h=e3a290fa9fc7c070434f954df0558e4c4ef60c5d;hb=18c38880bdfe4694fdf6bc3bbbea90740930aa65;hp=9989ac859e0b9d71dd7b12877842b46ef255bb13;hpb=31f6b164fd451ef9254545a38e7b6ffc1543854f;p=pazpar2-moved-to-github.git
diff --git a/src/http_command.c b/src/http_command.c
index 9989ac8..e3a290f 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
@@ -117,6 +117,7 @@ static const char *get_msg(enum pazpar2_error_code code)
{ PAZPAR2_CONFIG_TARGET, "Target cannot be configured"},
{ PAZPAR2_RECORD_FAIL, "Record command failed"},
{ PAZPAR2_NOT_IMPLEMENTED, "Not implemented"},
+ { PAZPAR2_NO_SERVICE, "No service"},
{ PAZPAR2_LAST_ERROR, "Last error"},
{ 0, 0 }
};
@@ -279,7 +280,7 @@ static void cmd_init(struct http_channel *c)
service = locate_service(c->server, service_name);
if (!service)
{
- error(rs, PAZPAR2_MALFORMED_PARAMETER_VALUE, "service");
+ error(rs, PAZPAR2_NO_SERVICE, service_name ? service_name : "unnamed");
return;
}
service_incref(service);
@@ -296,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);
}