diff --git a/Makefile b/Makefile
index 79121996..e432fa3e 100644
--- a/Makefile
+++ b/Makefile
@@ -152,16 +152,10 @@ ${TSTDIR}${OBJDIR}%${OBJEXT} : ${TSTDIR}%.c
all: ${LIBDIR}libhttp${LIBEXT} testmime${EXEEXT}
-#
-# Temporarily removed from all: rule
-# libhttpserver${EXEEXT}
-#
-
clean:
${RM} ${OBJDIR}*${OBJEXT}
${RM} ${LIBDIR}libhttp${LIBEXT}
${RM} testmime${EXEEXT}
- ${RM} libhttpserver${EXEEXT}
testmime${EXEEXT} : \
${TSTDIR}${OBJDIR}testmime${OBJEXT} \
@@ -173,18 +167,6 @@ testmime${EXEEXT} : \
${LIBS}
${STRIP} testmime${EXEEXT}
-
-libhttpserver${EXEEXT} : \
- ${OBJDIR}main${OBJEXT} \
- ${LIBDIR}libhttp${LIBEXT} \
- Makefile
- ${LINK} ${XFLAG}libhttpserver${EXEEXT} \
- ${OBJDIR}main${OBJEXT} \
- ${LIBDIR}libhttp${LIBEXT} \
- ${LIBS}
- ${STRIP} libhttpserver${EXEEXT}
-
-
OBJLIST = \
${OBJDIR}extern_md5${OBJEXT} \
${OBJDIR}extern_sha1${OBJEXT} \
diff --git a/doc/Building.md b/doc/Building.md
index 6ed26194..8ed81c03 100644
--- a/doc/Building.md
+++ b/doc/Building.md
@@ -55,13 +55,12 @@ Clean up files generated during the build
Make options can be set on the command line with the make command like so.
```
-make build WITH_LUA=1
+make build WITH_IPV6=1
```
| Make Options | Description |
| ------------------------- | ---------------------------------------- |
-| WITH_LUA=1 | build with Lua support |
| WITH_DEBUG=1 | build with GDB debug support |
| WITH_IPV6=1 | with IPV6 support |
| WITH_WEBSOCKET=1 | build with web socket support |
@@ -119,34 +118,3 @@ one additional *package* rule.
```
make -f Makefile.osx package
```
-
-Building on Android
----------
-
-This is a small guide to help you run LibHTTP on Android. Currently it is
-tested on the HTC Wildfire. If you have managed to run it on other devices
-as well, please comment or drop an email in the mailing list.
-Note: You do not need root access to run LibHTTP on Android.
-
-- Download the source from the Downloads page.
-- Download the Android NDK from [http://developer.android.com/tools/sdk/ndk/index.html](http://developer.android.com/tools/sdk/ndk/index.html)
-- Run `/path-to-ndk/ndk-build -C /path-to-libhttp/resources`
- That should generate libhttp/lib/armeabi/libhttp
-- Using the adb tool (you need to have Android SDK installed for that),
- push the generated libhttp binary to `/data/local` folder on device.
-- From adb shell, navigate to `/data/local` and execute `./libhttp`.
-- To test if the server is running fine, visit your web-browser and
- navigate to `http://127.0.0.1:8080` You should see the `Index of /` page.
-
-
-
-
-Notes:
-
-- `jni` stands for Java Native Interface. Read up on Android NDK if you want
- to know how to interact with the native C functions of libhttp in Android
- Java applications.
-- TODO: A Java application that interacts with the native binary or a
- shared library.
-
-
diff --git a/doc/Embedding.md b/doc/Embedding.md
index be61e19e..8899d75e 100644
--- a/doc/Embedding.md
+++ b/doc/Embedding.md
@@ -3,7 +3,7 @@ Embedding LibHTTP
LibHTTP is primarily designed so applications can easily add HTTP and HTTPS server as well as WebSocket functionality. For example, an application server could use LibHTTP to enable a web service interface for automation or remote control.
-However, it can also be used as a stand-alone executable. It can deliver static files and offers built-in server side Lua, JavaScript and CGI support. Some instructions how to build the stand-alone server can be found in [Building.md](Building.md).
+It can deliver static files and offers built-in server side Lua, JavaScript and CGI support. Some instructions how to build the stand-alone server can be found in [Building.md](Building.md).
Files
------
@@ -25,28 +25,6 @@ but all functions required to run a HTTP server.
- src/libhttp.c
- src/md5.inl (MD5 calculation)
- src/handle_form.inl (HTML form handling functions)
- - Optional: C++ wrapper
- - include/LibHTTPServer.h (C++ interface)
- - src/LibHTTPServer.cpp (C++ wrapper implementation)
- - Optional: Third party components
- - src/third_party/* (third party components, mainly used for the standalone server)
- - src/mod_*.inl (modules to access third party components from LibHTTP)
-
-Note: The C++ wrapper uses the official C interface (libhttp.h) and does not add new features to the server. Some features available in the C interface might be missing in the C++ interface.
-
-#### Additional Source Files for Executables
-
-These files can be used to build a server executable. They contain a `main` function
-starting the HTTP server.
-
- - Stand-alone C Server
- - src/main.c
- - Reference embedded C Server
- - examples/embedded_c/embedded_c.c
- - Reference embedded C++ Server
- - examples/embedded_cpp/embedded_cpp.cpp
-
-Note: The "embedded" example is actively maintained, updated, extended and tested. Other examples in the examples/ folder might be outdated and remain there for reference.
Quick Start
------
@@ -61,72 +39,6 @@ By default, the server will automatically serve up files like a normal HTTP serv
- Use `httplib_set_request_handler()` to easily add your own request handlers.
- Use `httplib_stop()` to stop the server.
-### C++
- - Note that LibHTTP is Clean C, and C++ interface ```LibHTTPServer.h``` is only a wrapper layer around the C interface.
- Not all LibHTTP features available in C are also available in C++.
- - Create LibHTTPHandlers for each URI.
- - Register the handlers with `LibHTTPServer::addHandler()`
- - `LibHTTPServer` starts on contruction and stops on destruction.
- - Use contructor *options* to select the port and document root among other things.
- - Use constructor *callbacks* to add your own hooks.
-
-Lua Support
-------
-
-Lua is a server side include functionality. Files ending in .lua will be processed with Lua.
-
-##### Add the following CFLAGS
-
- - -DLUA_COMPAT_ALL
- - -DUSE_LUA
- - -DUSE_LUA_SQLITE3
- - -DUSE_LUA_FILE_SYSTEM
-
-##### Add the following sources
-
- - src/mod_lua.inl
- - src/third_party/lua-5.2.4/src
- + lapi.c
- + lauxlib.c
- + lbaselib.c
- + lbitlib.c
- + lcode.c
- + lcorolib.c
- + lctype.c
- + ldblib.c
- + ldebug.c
- + ldo.c
- + ldump.c
- + lfunc.c
- + lgc.c
- + linit.c
- + liolib.c
- + llex.c
- + lmathlib.c
- + lmem.c
- + loadlib.c
- + lobject.c
- + lopcodes.c
- + loslib.c
- + lparser.c
- + lstate.c
- + lstring.c
- + lstrlib.c
- + ltable.c
- + ltablib.c
- + ltm.c
- + lundump.c
- + lvm.c
- + lzio.c
- - src/third_party/sqlite3.c
- - src/third_party/sqlite3.h
- - src/third_party/lsqlite3.c
- - src/third_party/lfs.c
- - src/third_party/lfs.h
-
-This build is valid for Lua version Lua 5.2. It is also possible to build with Lua 5.1 (including LuaJIT) or Lua 5.3.
-
-
JavaScript Support
------
diff --git a/examples/embedded_cpp/Makefile b/examples/embedded_cpp/Makefile
deleted file mode 100644
index 65adf98b..00000000
--- a/examples/embedded_cpp/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Copyright (c) 2013 No Face Press, LLC
-# License http://opensource.org/licenses/mit-license.php MIT License
-#
-
-#This makefile is used to test the other Makefiles
-
-
-PROG = embedded_cpp
-SRC = embedded_cpp.cpp
-
-TOP = ../..
-CIVETWEB_LIB = libcivetweb.a
-
-CFLAGS = -I$(TOP)/include $(COPT)
-LIBS = -lpthread
-
-include $(TOP)/resources/Makefile.in-os
-
-ifeq ($(TARGET_OS),LINUX)
- LIBS += -ldl
-endif
-
-all: $(PROG)
-
-$(PROG): $(CIVETWEB_LIB) $(SRC)
- $(CXX) -o $@ $(CFLAGS) $(LDFLAGS) $(SRC) $(CIVETWEB_LIB) $(LIBS)
-
-$(CIVETWEB_LIB):
- $(MAKE) -C $(TOP) clean lib WITH_CPP=1
- cp $(TOP)/$(CIVETWEB_LIB) .
-
-clean:
- rm -f $(CIVETWEB_LIB) $(PROG)
-
-.PHONY: all clean
diff --git a/examples/embedded_cpp/embedded_cpp.cpp b/examples/embedded_cpp/embedded_cpp.cpp
deleted file mode 100644
index 03e48c1e..00000000
--- a/examples/embedded_cpp/embedded_cpp.cpp
+++ /dev/null
@@ -1,297 +0,0 @@
-/* Copyright (c) 2013-2014 the Civetweb developers
- * Copyright (c) 2013 No Face Press, LLC
- * License http://opensource.org/licenses/mit-license.php MIT License
- */
-
-// Simple example program on how to use Embedded C++ interface.
-
-#include "CivetServer.h"
-
-#ifdef _WIN32
-#include
-#else
-#include
-#endif
-
-#define DOCUMENT_ROOT "."
-#define PORT "8081"
-#define EXAMPLE_URI "/example"
-#define EXIT_URI "/exit"
-bool exitNow = false;
-
-class ExampleHandler : public CivetHandler
-{
- public:
- bool
- handleGet(CivetServer *server, struct httplib_connection *conn)
- {
- httplib_printf(conn,
- "HTTP/1.1 200 OK\r\nContent-Type: "
- "text/html\r\nConnection: close\r\n\r\n");
- httplib_printf(conn, "\r\n");
- httplib_printf(conn,
- "This is an example text from a C++ handler
\r\n");
- httplib_printf(conn,
- "To see a page from the A handler click here
\r\n");
- httplib_printf(conn,
- "To see a page from the A handler with a parameter "
- "click here
\r\n");
- httplib_printf(conn,
- "To see a page from the A/B handler click here
\r\n");
- httplib_printf(conn,
- "To see a page from the *.foo handler click here
\r\n");
- httplib_printf(conn,
- "To exit click here
\r\n",
- EXIT_URI);
- httplib_printf(conn, "\r\n");
- return true;
- }
-};
-
-class ExitHandler : public CivetHandler
-{
- public:
- bool
- handleGet(CivetServer *server, struct httplib_connection *conn)
- {
- httplib_printf(conn,
- "HTTP/1.1 200 OK\r\nContent-Type: "
- "text/plain\r\nConnection: close\r\n\r\n");
- httplib_printf(conn, "Bye!\n");
- exitNow = true;
- return true;
- }
-};
-
-class AHandler : public CivetHandler
-{
- private:
- bool
- handleAll(const char *method,
- CivetServer *server,
- struct httplib_connection *conn)
- {
- std::string s = "";
- httplib_printf(conn,
- "HTTP/1.1 200 OK\r\nContent-Type: "
- "text/html\r\nConnection: close\r\n\r\n");
- httplib_printf(conn, "");
- httplib_printf(conn, "This is the A handler for \"%s\" !
", method);
- if (CivetServer::getParam(conn, "param", s)) {
- httplib_printf(conn, "param set to %s
", s.c_str());
- } else {
- httplib_printf(conn, "param not set
");
- }
- httplib_printf(conn, "\n");
- return true;
- }
-
- public:
- bool
- handleGet(CivetServer *server, struct httplib_connection *conn)
- {
- return handleAll("GET", server, conn);
- }
- bool
- handlePost(CivetServer *server, struct httplib_connection *conn)
- {
- return handleAll("POST", server, conn);
- }
-};
-
-class ABHandler : public CivetHandler
-{
- public:
- bool
- handleGet(CivetServer *server, struct httplib_connection *conn)
- {
- httplib_printf(conn,
- "HTTP/1.1 200 OK\r\nContent-Type: "
- "text/html\r\nConnection: close\r\n\r\n");
- httplib_printf(conn, "");
- httplib_printf(conn, "This is the AB handler!!!
");
- httplib_printf(conn, "\n");
- return true;
- }
-};
-
-class FooHandler : public CivetHandler
-{
- public:
- bool
- handleGet(CivetServer *server, struct httplib_connection *conn)
- {
- /* Handler may access the request info using httplib_get_request_info */
- const struct httplib_request_info *req_info = httplib_get_request_info(conn);
-
- httplib_printf(conn,
- "HTTP/1.1 200 OK\r\nContent-Type: "
- "text/html\r\nConnection: close\r\n\r\n");
-
- httplib_printf(conn, "\n");
- httplib_printf(conn, "This is the Foo GET handler!!!
\n");
- httplib_printf(conn,
- "The request was:
%s %s HTTP/%s
\n",
- req_info->request_method,
- req_info->uri,
- req_info->http_version);
- httplib_printf(conn, "\n");
-
- return true;
- }
- bool
- handlePost(CivetServer *server, struct httplib_connection *conn)
- {
- /* Handler may access the request info using httplib_get_request_info */
- const struct httplib_request_info *req_info = httplib_get_request_info(conn);
- int64_t rlen;
- int64_t wlen;
- int64_t nlen = 0;
- int64_t tlen = req_info->content_length;
- char buf[1024];
-
- httplib_printf(conn,
- "HTTP/1.1 200 OK\r\nContent-Type: "
- "text/html\r\nConnection: close\r\n\r\n");
-
- httplib_printf(conn, "\n");
- httplib_printf(conn, "This is the Foo POST handler!!!
\n");
- httplib_printf(conn,
- "The request was:
%s %s HTTP/%s
\n",
- req_info->request_method,
- req_info->uri,
- req_info->http_version);
- httplib_printf(conn, "Content Length: %li
\n", (long)tlen);
- httplib_printf(conn, "\n");
-
- while (nlen < tlen) {
- rlen = tlen - nlen;
- if (rlen > sizeof(buf)) {
- rlen = sizeof(buf);
- }
- rlen = httplib_read(conn, buf, (size_t)rlen);
- if (rlen <= 0) break;
- wlen = httplib_write(conn, buf, (size_t)rlen);
- if (rlen != rlen) break;
- nlen += wlen;
- }
-
- httplib_printf(conn, "\n
\n");
- httplib_printf(conn, "\n");
-
- return true;
- }
-
- #define fopen_recursive fopen
-
- bool
- handlePut(CivetServer *server, struct httplib_connection *conn)
- {
- /* Handler may access the request info using httplib_get_request_info */
- const struct httplib_request_info *req_info = httplib_get_request_info(conn);
- int64_t rlen;
- int64_t wlen;
- int64_t nlen = 0;
- int64_t tlen = req_info->content_length;
- FILE * f;
- char buf[1024];
- int fail = 0;
-
-#ifdef _WIN32
- _snprintf(buf, sizeof(buf), "D:\\somewhere\\%s\\%s", req_info->remote_user, req_info->local_uri);
- buf[sizeof(buf)-1] = 0; /* TODO: check overflow */
- f = fopen_recursive(buf, "wb");
-#else
- snprintf(buf, sizeof(buf), "~/somewhere/%s/%s", req_info->remote_user, req_info->local_uri);
- buf[sizeof(buf)-1] = 0; /* TODO: check overflow */
- f = fopen_recursive(buf, "w");
-#endif
-
- if (!f) {
- fail = 1;
- } else {
- while (nlen < tlen) {
- rlen = tlen - nlen;
- if (rlen > sizeof(buf)) {
- rlen = sizeof(buf);
- }
- rlen = httplib_read(conn, buf, (size_t)rlen);
- if (rlen <= 0) {
- fail = 1;
- break;
- }
- wlen = fwrite(buf, 1, (size_t)rlen, f);
- if (rlen != rlen) {
- fail = 1;
- break;
- }
- nlen += wlen;
- }
- fclose(f);
- }
-
- if (fail) {
- httplib_printf(conn,
- "HTTP/1.1 409 Conflict\r\n"
- "Content-Type: text/plain\r\n"
- "Connection: close\r\n\r\n");
- } else {
- httplib_printf(conn,
- "HTTP/1.1 201 Created\r\n"
- "Content-Type: text/plain\r\n"
- "Connection: close\r\n\r\n");
- }
-
- return true;
- }
-};
-
-
-int
-main(int argc, char *argv[])
-{
- const char *options[] = {
- "document_root", DOCUMENT_ROOT, "listening_ports", PORT, 0};
-
- std::vector cpp_options;
- for (int i=0; i<(sizeof(options)/sizeof(options[0])-1); i++) {
- cpp_options.push_back(options[i]);
- }
-
- // CivetServer server(options); // <-- C style start
- CivetServer server(cpp_options); // <-- C++ style start
-
- ExampleHandler h_ex;
- server.addHandler(EXAMPLE_URI, h_ex);
-
- ExitHandler h_exit;
- server.addHandler(EXIT_URI, h_exit);
-
- AHandler h_a;
- server.addHandler("/a", h_a);
-
- ABHandler h_ab;
- server.addHandler("/a/b", h_ab);
-
- FooHandler h_foo;
- server.addHandler("", h_foo);
-
- printf("Browse files at http://localhost:%s/\n", PORT);
- printf("Run example at http://localhost:%s%s\n", PORT, EXAMPLE_URI);
- printf("Exit at http://localhost:%s%s\n", PORT, EXIT_URI);
-
- while (!exitNow) {
-#ifdef _WIN32
- Sleep(1000);
-#else
- sleep(1);
-#endif
- }
-
- printf("Bye!\n");
-
- return 0;
-}
diff --git a/include/LibHTTPServer.h b/include/LibHTTPServer.h
deleted file mode 100644
index 6fcc66a2..00000000
--- a/include/LibHTTPServer.h
+++ /dev/null
@@ -1,588 +0,0 @@
-/*
- * Copyright (c) 2016 Lammert Bies
- * Copyright (c) 2013-2014 the Civetweb developers
- * Copyright (c) 2013 No Face Press, LLC
- *
- * License http://opensource.org/licenses/mit-license.php MIT License
- */
-
-#ifndef _CIVETWEB_SERVER_H_
-#define _CIVETWEB_SERVER_H_
-#ifdef __cplusplus
-
-#include "libhttp.h"
-#include