summaryrefslogtreecommitdiffstats
path: root/source/cWebAdmin.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-05-25 09:18:52 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-05-25 09:18:52 +0200
commita4a418a679f1ac760a8763edd856f0178cfc6dde (patch)
tree85300ca3a2b3a942998a0c864ae90894857ebf5f /source/cWebAdmin.cpp
parentFixed output directory structure in the "Release profiled" configuration (diff)
downloadcuberite-a4a418a679f1ac760a8763edd856f0178cfc6dde.tar
cuberite-a4a418a679f1ac760a8763edd856f0178cfc6dde.tar.gz
cuberite-a4a418a679f1ac760a8763edd856f0178cfc6dde.tar.bz2
cuberite-a4a418a679f1ac760a8763edd856f0178cfc6dde.tar.lz
cuberite-a4a418a679f1ac760a8763edd856f0178cfc6dde.tar.xz
cuberite-a4a418a679f1ac760a8763edd856f0178cfc6dde.tar.zst
cuberite-a4a418a679f1ac760a8763edd856f0178cfc6dde.zip
Diffstat (limited to '')
-rw-r--r--source/cWebAdmin.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/source/cWebAdmin.cpp b/source/cWebAdmin.cpp
index 57aea3146..d9a89b961 100644
--- a/source/cWebAdmin.cpp
+++ b/source/cWebAdmin.cpp
@@ -310,6 +310,10 @@ bool cWebAdmin::Init( int a_Port )
return true;
}
+
+
+
+
#ifdef _WIN32
DWORD WINAPI cWebAdmin::ListenThread(LPVOID lpParam)
#else
@@ -319,7 +323,10 @@ void *cWebAdmin::ListenThread( void *lpParam )
cWebAdmin* self = (cWebAdmin*)lpParam;
self->m_WebServer = new webserver(self->m_Port, Request_Handler );
- self->m_WebServer->Begin();
+ if (!self->m_WebServer->Begin())
+ {
+ LOGWARN("WebServer failed to start! WebAdmin is disabled");
+ }
self->m_Event->Set();
return 0;
@@ -341,20 +348,8 @@ std::string cWebAdmin::GetTemplate()
return "";
}
- // obtain file size:
- int lSize = f.GetSize();
-
- // allocate memory to contain the whole file:
- std::auto_ptr<char> buffer(new char[lSize]); // auto_ptr deletes the memory in its destructor
-
// copy the file into the buffer:
- if (f.Read(buffer.get(), lSize) != lSize)
- {
- LOG ("WEBADMIN: Could not read file \"%s\"", SourceFile);
- return "";
- }
-
- retVal.assign(buffer.get(), lSize );
+ f.ReadRestOfFile(retVal);
return retVal;
}