summaryrefslogtreecommitdiff
path: root/server/src/sessionserialiser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/sessionserialiser.cc')
-rw-r--r--server/src/sessionserialiser.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/server/src/sessionserialiser.cc b/server/src/sessionserialiser.cc
index 9706d22..9489bd7 100644
--- a/server/src/sessionserialiser.cc
+++ b/server/src/sessionserialiser.cc
@@ -33,6 +33,7 @@
#include "database.h"
#include "xml_encode_decode.h"
+//#include "base64.h"
#include <stdio.h>
#include <string.h>
@@ -60,6 +61,9 @@ SessionSerialiser::SessionSerialiser(std::string path, Session *session)
#define XENC(s) xml_encode(s)
#define XDEC(s) xml_decode(s)
+//#define BENC(s) base64encode(s)
+//#define BDEC(s) base64decode(s)
+
void SessionSerialiser::loadStr(const std::string &xml)
{
// SessionAutolock lock(*session);
@@ -123,9 +127,13 @@ void SessionSerialiser::load()
std::string filename = getSessionFilename(path, session->id());
FILE *fp = fopen(filename.c_str(), "r");
- char xml[2048];
- memset(xml, 0, sizeof(xml));
- fread(xml, sizeof(xml), 1, fp);
+ std::string xml;
+ while(!feof(fp)) {
+ char str[64];
+ memset(str, 0, sizeof(str));
+ fread(str, sizeof(str) - 1, 1, fp);
+ xml += str;
+ }
fclose(fp);
loadStr(xml);