summaryrefslogtreecommitdiff
path: root/client/netcom.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/netcom.cc')
-rw-r--r--client/netcom.cc32
1 files changed, 29 insertions, 3 deletions
diff --git a/client/netcom.cc b/client/netcom.cc
index be240e2..4126b02 100644
--- a/client/netcom.cc
+++ b/client/netcom.cc
@@ -62,12 +62,34 @@ NetCom::NetCom(QString host, quint16 port, QString user, QString cpr)
#else
http.setHost(host, QHttp::ConnectionModeHttp, port);
#endif
-
+
transfering = false;
+
+ QHttpRequestHeader h("HTTP 1.1", "/");
+ http.request(h, "");
+
+ transfering = true;
+ buffer = "";
+ do {
+ qApp->processEvents(QEventLoop::WaitForMoreEvents);
+ } while(transfering);
+
+ sessionid = http.lastResponse().value("SessionID");
+ printf("SESSION ID: %s\n", sessionid.toStdString().c_str());
}
NetCom::~NetCom()
{
+ QHttpRequestHeader h("HTTP 1.1", "/");
+ h.setValue("SessionCommit", "");
+ h.setValue("SessionID", sessionid);
+ http.request(h, "");
+
+ transfering = true;
+ buffer = "";
+ do {
+ qApp->processEvents(QEventLoop::WaitForMoreEvents);
+ } while(transfering);
}
QDomDocument NetCom::send(QString templ, QString macro, bool lockgui)
@@ -93,7 +115,9 @@ QDomDocument NetCom::send(QString templ, QString macro, bool lockgui)
printf("\nSending request:\n%s", doc.toString().toStdString().c_str());
- http.post("/", doc.toByteArray());
+ QHttpRequestHeader h("HTTP 1.1", "/");
+ h.setValue("SessionID", sessionid);
+ http.request(h, doc.toByteArray());
QDomDocument res_doc;
transfering = true;
@@ -151,7 +175,9 @@ void NetCom::send(QVector< Widget* > widgets, QString templ, QString macro, QStr
printf("\nSending commit:\n%s", doc.toString().toStdString().c_str());
- http.post("/", doc.toByteArray());
+ QHttpRequestHeader h("HTTP 1.1", "/");
+ h.setValue("SessionID", sessionid);
+ http.request(h, doc.toByteArray());
transfering = true;
buffer = "";