diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/netcom.cc | 32 | ||||
-rw-r--r-- | client/netcom.h | 1 |
2 files changed, 30 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 = ""; diff --git a/client/netcom.h b/client/netcom.h index f1a8766..718d5a6 100644 --- a/client/netcom.h +++ b/client/netcom.h @@ -64,6 +64,7 @@ private: QHttp http; QByteArray buffer; + QString sessionid; }; #endif/*__PRACRO_NETCOM_H__*/ |