sic/src/UltraSimpleStaticFileHandle...

48 lines
1.2 KiB
C++
Raw Normal View History

2014-01-18 14:48:52 +01:00
#include <string>
#include "UltraSimpleStaticFileHandler.H"
#include <mongoose.h>
2014-01-17 23:47:14 +01:00
static const char * hello_world_html = u8R"HERE(
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="generator" content="pandoc">
<title></title>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<h1 id="sharing-is-caring">Sharing is caring</h1>
<p>Hello World!</p>
<h2 id="it-works">It works</h2>
<p>It seems like a working page has been served</p>
</body>
</html>)HERE";
2014-01-25 23:32:02 +01:00
#include <iostream>
2014-01-17 23:47:14 +01:00
2014-01-25 23:32:02 +01:00
UltraSimpleStaticFileHandler::UltraSimpleStaticFileHandler()
{
std::cout << "hallo ausm construktor von USSFH [" << this << "] "
<< std::endl;
}
UltraSimpleStaticFileHandler::~UltraSimpleStaticFileHandler(){
std::cout << "Arrrr aus destruktor! und (∀Gute) zum Pinguintag!!" << std::endl;
}
2014-01-25 23:32:02 +01:00
int UltraSimpleStaticFileHandler::answer_pathreq(const char * const path __attribute__((unused)),
struct mg_connection *conn)
2014-01-17 23:47:14 +01:00
{
mg_printf(conn, "HTTP/1.0 200 OK\r\n"
"Content-Length: %lu\r\n"
"Content-Type: text/html\r\n\r\n%s",
sizeof(hello_world_html),
hello_world_html);
return 0;
}