diff --git a/HTTPServer.cpp b/HTTPServer.cpp
index 142c392b..864c9fd3 100644
--- a/HTTPServer.cpp
+++ b/HTTPServer.cpp
@@ -265,6 +265,43 @@ namespace http {
s << " " << (int) (bytes / 1024) << " KiB
\r\n";
}
+ void ShowPageHead (std::stringstream& s)
+ {
+ s <<
+ "\r\n"
+ "\r\n" /* TODO: Add support for locale */
+ "
\r\n"
+ " \r\n" /* TODO: Find something to parse html/template system. This is horrible. */
+ " \r\n"
+ " Purple I2P " VERSION " Webconsole\r\n"
+ << cssStyles <<
+ "\r\n";
+ s <<
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "
\r\n"
+ "
";
+ }
+
+ void ShowPageTail (std::stringstream& s)
+ {
+ s <<
+ "
\r\n"
+ "\r\n"
+ "\r\n";
+ }
+
void ShowStatus (std::stringstream& s)
{
s << "Uptime: ";
@@ -649,43 +686,14 @@ namespace http {
{
std::stringstream s;
// Html5 head start
- s <<
- "\r\n"
- "\r\n" /* TODO: Add support for locale */
- " \r\n"
- " \r\n" /* TODO: Find something to parse html/template system. This is horrible. */
- " \r\n"
- " Purple I2P " VERSION " Webconsole\r\n"
- << cssStyles <<
- "\r\n";
- s <<
- "\r\n"
- "\r\n"
- "\r\n"
- "
\r\n";
- s << "
";
+ ShowPageHead (s);
if (uri.find("page=") != std::string::npos)
HandlePage (s, uri);
else if (uri.find("cmd=") != std::string::npos)
HandleCommand (s, uri);
else
ShowStatus (s);
- s <<
- "
\r\n"
- "\r\n"
- "\r\n";
+ ShowPageTail (s);
SendReply (s.str ());
}