/* 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
{ 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 }
};
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);
s->session_id = sesid;
if (process_settings(s->psession, c->request, c->response) < 0)
return;
- sprintf(buf, HTTP_COMMAND_RESPONSE_PREFIX "<init><status>OK</status><session>%u</session>"
- "<protocol>" PAZPAR2_PROTOCOL_VERSION "</protocol></init>", sesid);
+
+ sprintf(buf, HTTP_COMMAND_RESPONSE_PREFIX
+ "<init><status>OK</status><session>%u", sesid);
+ if (c->server->server_id)
+ {
+ strcat(buf, ".");
+ strcat(buf, c->server->server_id);
+ }
+ strcat(buf, "</session>"
+ "<protocol>" PAZPAR2_PROTOCOL_VERSION "</protocol></init>");
rs->payload = nmem_strdup(c->nmem, buf);
http_send_response(c);
}