diff options
author | deva <deva> | 2009-11-13 11:00:08 +0000 |
---|---|---|
committer | deva <deva> | 2009-11-13 11:00:08 +0000 |
commit | d7c7c961e8c35c2d8587ec7f60aac5e309284a97 (patch) | |
tree | 3f1b4fb382a7ece23c944eeeca2e8eb61f1d25aa /client/netcom.cc | |
parent | 90fe99277f0300eb7f0b80545d6a21f94198d45f (diff) |
Added SessionIDs to http communication. Made SAXParser run on const char*.
Diffstat (limited to 'client/netcom.cc')
-rw-r--r-- | client/netcom.cc | 32 |
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 = ""; |