mirror of
https://github.com/lammertb/libhttp.git
synced 2025-07-03 06:22:34 +03:00
Normallized coding style in a predictable way.
Uses astyle program which is freely avaiable on all platforms.
This commit is contained in:
@ -17,20 +17,22 @@
|
||||
#define EXIT_URI "/exit"
|
||||
bool exitNow = false;
|
||||
|
||||
class ExampleHandler: public CivetHandler {
|
||||
class ExampleHandler: public CivetHandler
|
||||
{
|
||||
public:
|
||||
bool handleGet(CivetServer *server, struct mg_connection *conn) {
|
||||
mg_printf(conn, "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n");
|
||||
mg_printf(conn, "<html><body>");
|
||||
mg_printf(conn, "<h2>This is example text!!!</h2>");
|
||||
mg_printf(conn, "<p>To exit <a href=\"%s\">click here</a></p>",
|
||||
EXIT_URI);
|
||||
EXIT_URI);
|
||||
mg_printf(conn, "</body></html>\n");
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class ExitHandler: public CivetHandler {
|
||||
class ExitHandler: public CivetHandler
|
||||
{
|
||||
public:
|
||||
bool handleGet(CivetServer *server, struct mg_connection *conn) {
|
||||
mg_printf(conn, "HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n\r\n");
|
||||
@ -40,7 +42,8 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class AHandler: public CivetHandler {
|
||||
class AHandler: public CivetHandler
|
||||
{
|
||||
public:
|
||||
bool handleGet(CivetServer *server, struct mg_connection *conn) {
|
||||
mg_printf(conn, "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n");
|
||||
@ -51,7 +54,8 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class ABHandler: public CivetHandler {
|
||||
class ABHandler: public CivetHandler
|
||||
{
|
||||
public:
|
||||
bool handleGet(CivetServer *server, struct mg_connection *conn) {
|
||||
mg_printf(conn, "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n");
|
||||
@ -62,10 +66,12 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
const char * options[] = { "document_root", DOCUMENT_ROOT,
|
||||
"listening_ports", PORT, 0 };
|
||||
"listening_ports", PORT, 0
|
||||
};
|
||||
|
||||
CivetServer server(options);
|
||||
|
||||
|
Reference in New Issue
Block a user