summaryrefslogtreecommitdiff
path: root/server/src/client_connection.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/client_connection.cc')
-rw-r--r--server/src/client_connection.cc33
1 files changed, 22 insertions, 11 deletions
diff --git a/server/src/client_connection.cc b/server/src/client_connection.cc
index af70916..9689ac4 100644
--- a/server/src/client_connection.cc
+++ b/server/src/client_connection.cc
@@ -54,11 +54,22 @@ ClientConnection::Parameters::Parameters()
nocommit = false;
}
-ClientConnection::ClientConnection(Environment &e, Parameters p)
- : parms(p), env(e), parser(&transaction)
+ClientConnection::ClientConnection(Environment &e, headers_t &headers)
+ : env(e), parser(&transaction)
{
DEBUG(connection, "[%p] CREATE\n", this);
+ if(headers.contains("SessionID"))
+ parms.sessionid = headers["SessionID"];
+ if(headers.contains("SessionPatientID"))
+ parms.patientid = headers["SessionPatientID"];
+ if(headers.contains("SessionTemplate"))
+ parms.templ = headers["SessionTemplate"];
+
+ parms.commit = headers.contains("SessionCommit");
+ parms.nocommit = headers.contains("SessionNoCommit");
+ parms.discard = headers.contains("SessionDiscard");
+
#ifdef TEST_CONNECTION
did_commit = false;
#endif
@@ -183,21 +194,21 @@ bool ClientConnection::handle(const char *data, size_t size)
return false;
}
-std::string ClientConnection::getResponse()
-{
- if(parser_complete == false)
- return error_box(xml_encode("XML Parser need more data."));
- return response;
-}
-
-headers_t ClientConnection::getHeaders()
+void ClientConnection::getReply(Httpd::Reply &reply)
{
headers_t hdrs;
hdrs["Content-Type"] = "text/plain; charset=UTF-8";
hdrs["SessionID"] = parms.sessionid;
- return hdrs;
+ reply.headers = hdrs;
+
+ if(parser_complete == false)
+ reply.data = error_box(xml_encode("XML Parser need more data."));
+ else
+ reply.data = response;
+
+ reply.status = 200; // http 'OK'
}
#ifdef TEST_CLIENT_CONNECTION