소스 검색

Regorganized directories to make them more intuitive

Thomas Davis 12 년 전
부모
커밋
b2aee90d14
100개의 변경된 파일764개의 추가작업 그리고 659개의 파일을 삭제
  1. 14 10
      Makefile
  2. 21 22
      Makefile.deprecated
  3. 3 3
      Makefile.osx
  4. 1 1
      README.md
  5. 3 2
      RELEASE_NOTES.md
  6. 7 10
      VS2012/civetweb/civetweb.vcxproj
  7. 5 10
      VS2012/civetweb/civetweb.vcxproj.filters
  8. 10 14
      VS2012/civetweb_lua/civetweb_lua.vcxproj
  9. 8 16
      VS2012/civetweb_lua/civetweb_lua.vcxproj.filters
  10. 7 10
      VS2012/civetweb_yassl/civetweb_yassl/civetweb_yassl.vcxproj
  11. 5 10
      VS2012/civetweb_yassl/civetweb_yassl/civetweb_yassl.vcxproj.filters
  12. 8 11
      VS2012/ex_embed_cpp/ex_embed_cpp.vcxproj
  13. 6 11
      VS2012/ex_embed_cpp/ex_embed_cpp.vcxproj.filters
  14. 5 8
      VS2012/ex_websocket/ex_websocket.vcxproj
  15. 3 8
      VS2012/ex_websocket/ex_websocket.vcxproj.filters
  16. 37 37
      VS2012/lua_lib/lua_lib.vcxproj
  17. 35 35
      VS2012/lua_lib/lua_lib.vcxproj.filters
  18. 0 50
      build/ssl_cert.pem
  19. 0 127
      cpp/CivetServer.cpp
  20. 0 193
      cpp/CivetServer.h
  21. 0 23
      cpp/Makefile
  22. 7 3
      docs/Building.md
  23. 12 12
      docs/Embedding.md
  24. 3 3
      docs/UserManual.md
  25. 0 26
      examples/Makefile
  26. 40 0
      examples/chat/Makefile
  27. 0 0
      examples/chat/chat.c
  28. 0 0
      examples/docroot/favicon.ico
  29. 0 0
      examples/docroot/index.html
  30. 0 0
      examples/docroot/jquery.js
  31. 0 0
      examples/docroot/login.html
  32. 0 0
      examples/docroot/logo.png
  33. 0 0
      examples/docroot/main.js
  34. 0 0
      examples/docroot/prime_numbers.lp
  35. 0 0
      examples/docroot/style.css
  36. 36 0
      examples/embedded_cpp/Makefile
  37. 0 0
      examples/embedded_cpp/embedded_cpp.cpp
  38. 36 0
      examples/hello/Makefile
  39. 0 0
      examples/hello/hello.c
  40. 0 0
      examples/lua/lua_dll.c
  41. 36 0
      examples/post/Makefile
  42. 0 0
      examples/post/post.c
  43. 36 0
      examples/upload/Makefile
  44. 0 0
      examples/upload/upload.c
  45. 36 0
      examples/websocket/Makefile
  46. 0 0
      examples/websocket/docroot/index.html
  47. 0 0
      examples/websocket/websocket.c
  48. 185 0
      include/CivetServer.h
  49. 1 1
      include/civetweb.h
  50. 0 0
      resources/Info.plist
  51. 2 2
      resources/Makefile.in-lua
  52. 0 0
      resources/Makefile.in-os
  53. 0 0
      resources/civetweb.icns
  54. 0 0
      resources/civetweb.psd
  55. 0 0
      resources/civetweb_16x16.png
  56. 0 0
      resources/civetweb_16x16@2.png
  57. 0 0
      resources/civetweb_22x22.png
  58. 0 0
      resources/civetweb_22x22@2.png
  59. 0 0
      resources/civetweb_32x32.png
  60. 0 0
      resources/civetweb_32x32@2.png
  61. 0 0
      resources/civetweb_64x64.png
  62. 0 0
      resources/civetweb_64x64@2.png
  63. 0 0
      resources/dll.def
  64. 1 1
      resources/jni/Android.mk
  65. 0 0
      resources/res.rc
  66. 0 0
      resources/ssl_cert.pem
  67. 0 0
      resources/systray.ico
  68. 155 0
      src/CivetServer.cpp
  69. 0 0
      src/civetweb.c
  70. 0 0
      src/main.c
  71. 0 0
      src/md5.inl
  72. 0 0
      src/mod_lua.inl
  73. 0 0
      src/third_party/lsqlite3.c
  74. 0 0
      src/third_party/lua-5.2.2/Makefile
  75. 0 0
      src/third_party/lua-5.2.2/README
  76. 0 0
      src/third_party/lua-5.2.2/doc/contents.html
  77. 0 0
      src/third_party/lua-5.2.2/doc/logo.gif
  78. 0 0
      src/third_party/lua-5.2.2/doc/lua.1
  79. 0 0
      src/third_party/lua-5.2.2/doc/lua.css
  80. 0 0
      src/third_party/lua-5.2.2/doc/luac.1
  81. 0 0
      src/third_party/lua-5.2.2/doc/manual.css
  82. 0 0
      src/third_party/lua-5.2.2/doc/manual.html
  83. 0 0
      src/third_party/lua-5.2.2/doc/osi-certified-72x60.png
  84. 0 0
      src/third_party/lua-5.2.2/doc/readme.html
  85. 0 0
      src/third_party/lua-5.2.2/src/Makefile
  86. 0 0
      src/third_party/lua-5.2.2/src/lapi.c
  87. 0 0
      src/third_party/lua-5.2.2/src/lapi.h
  88. 0 0
      src/third_party/lua-5.2.2/src/lauxlib.c
  89. 0 0
      src/third_party/lua-5.2.2/src/lauxlib.h
  90. 0 0
      src/third_party/lua-5.2.2/src/lbaselib.c
  91. 0 0
      src/third_party/lua-5.2.2/src/lbitlib.c
  92. 0 0
      src/third_party/lua-5.2.2/src/lcode.c
  93. 0 0
      src/third_party/lua-5.2.2/src/lcode.h
  94. 0 0
      src/third_party/lua-5.2.2/src/lcorolib.c
  95. 0 0
      src/third_party/lua-5.2.2/src/lctype.c
  96. 0 0
      src/third_party/lua-5.2.2/src/lctype.h
  97. 0 0
      src/third_party/lua-5.2.2/src/ldblib.c
  98. 0 0
      src/third_party/lua-5.2.2/src/ldebug.c
  99. 0 0
      src/third_party/lua-5.2.2/src/ldebug.h
  100. 0 0
      src/third_party/lua-5.2.2/src/ldo.c

+ 14 - 10
Makefile

@@ -7,7 +7,7 @@
 # For help try, "make help"
 #
 
-include build/Makefile.in-os
+include resources/Makefile.in-os
 
 CPROG = civetweb
 #CXXPROG = civetweb
@@ -23,32 +23,30 @@ DATAROOTDIR = $(PREFIX)/share
 DOCDIR = $(DATAROOTDIR)/doc/$(CPROG)
 SYSCONFDIR = $(PREFIX)/etc
 
-BUILD_DIRS += $(BUILD_DIR)
+BUILD_DIRS += $(BUILD_DIR) $(BUILD_DIR)/src
 
-LIB_SOURCES = civetweb.c
-APP_SOURCES = main.c
+LIB_SOURCES = src/civetweb.c
+APP_SOURCES = src/main.c
 SOURCE_DIRS =
 
 OBJECTS = $(LIB_SOURCES:.c=.o) $(APP_SOURCES:.c=.o)
 
 # only set main compile options if none were chosen
-CFLAGS += -W -Wall -O2 -D$(TARGET_OS) -I. $(COPT)
+CFLAGS += -W -Wall -O2 -D$(TARGET_OS) -Iinclude $(COPT)
 
 ifdef WITH_DEBUG
   CFLAGS += -g -DDEBUG_ENABLED
 endif
 
 ifdef WITH_CPP
-  OBJECTS += cpp/CivetServer.o
-  BUILD_DIRS += $(BUILD_DIR)/cpp
-  CFLAGS += -Icpp
+  OBJECTS += src/CivetServer.o
   LCC = $(CXX)
 else
   LCC = $(CC)
 endif
 
 ifdef WITH_LUA
- include build/Makefile.in-lua
+ include resources/Makefile.in-lua
 endif
 
 ifdef WITH_IPV6
@@ -142,12 +140,18 @@ slib: lib$(CPROG).so
 clean:
 	rm -rf $(BUILD_DIR)
 
+distclean: clean
+	@rm -rf VS2012/Debug VS2012/*/Debug  VS2012/*/*/Debug
+	@rm -rf VS2012/Release VS2012/*/Release  VS2012/*/*/Release
+	rm -f $(CPROG) lib$(CPROG).so lib$(CPROG).a *.dmg 
+
 lib$(CPROG).a: $(BUILD_DIRS) $(LIB_OBJECTS)
 	@rm -f $@ 
 	ar cq $@ $(LIB_OBJECTS)
 
+lib$(CPROG).so: CFLAGS += -fPIC
 lib$(CPROG).so: $(BUILD_DIRS) $(LIB_OBJECTS)
-	$(LCC) -fPIC -shared -o $@ $(CFLAGS) $(LDFLAGS) $(LIB_OBJECTS)
+	$(LCC) -shared -o $@ $(CFLAGS) $(LDFLAGS) $(LIB_OBJECTS)
 
 $(CPROG): $(BUILD_DIRS) $(BUILD_OBJECTS)
 	$(LCC) -o $@ $(CFLAGS) $(LDFLAGS) $(BUILD_OBJECTS) $(LIBS)

+ 21 - 22
Makefile.deprecated

@@ -17,11 +17,11 @@
 # -DUSE_LUA               - embed Lua in Civetweb (+100kb)
 
 PROG        = civetweb
-CFLAGS      = -std=c99 -O2 -W -Wall -pedantic -pthread -pipe $(COPT)
+CFLAGS      = -std=c99 -O2 -W -Wall -pedantic -pthread -pipe -Iinclude $(COPT)
 
-# To build with Lua, download and unzip Lua 5.2.1 source code into the
+# To build with Lua, download and unzip Lua 5.2.2 source code into the
 # civetweb directory, and then add $(LUA_SOURCES) to CFLAGS
-LUA         = lua-5.2.1/src
+LUA         = src/third_party/lua-5.2.2/src
 LUA_FLAGS   = -I$(LUA) -DLUA_COMPAT_ALL
 LUA_SOURCES = $(LUA)/lapi.c $(LUA)/lcode.c $(LUA)/lctype.c \
               $(LUA)/ldebug.c $(LUA)/ldo.c $(LUA)/ldump.c \
@@ -40,9 +40,9 @@ ifneq ($(OS), Windows_NT)
   LUA_FLAGS += -DLUA_USE_DLOPEN
 endif
 
-LIB_SOURCES = civetweb.c md5.c 
+LIB_SOURCES = src/civetweb.c
 
-ALL_SOURCES = main.c $(LIB_SOURCES) build/sqlite3.c build/lsqlite3.c \
+ALL_SOURCES = src/main.c $(LIB_SOURCES) src/third_party/sqlite3.c src/third_party/lsqlite3.c \
               $(LUA_SOURCES) $(YASSL_SOURCES)
 
 SQLITE_FLAGS = -DTHREADSAFE=1 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS
@@ -114,28 +114,28 @@ all:
 lua.lib: $(LUA_WINOBJS)
 	$(MSVC)/bin/lib /out:$@ $(LUA_WINOBJS)
 
-# To build with lua, make sure you have Lua unpacked into lua-5.2.1 directory
+# To build with lua, make sure you have Lua unpacked into src/third_party/lua-5.2.1 directory
 linux_lua: $(ALL_OBJECTS)
 	$(CC) $(ALL_OBJECTS) -o $(PROG) -ldl
 
-civetweb.o: mod_lua.inl
+civetweb.o: src/mod_lua.inl
 
 # Make sure that the compiler flags come last in the compilation string.
 # If not so, this can break some on some Linux distros which use
 # "-Wl,--as-needed" turned on by default  in cc command.
 # Also, this is turned in many other distros in static linkage builds.
 linux:
-	$(CC) $(LIB_SOURCES) main.c -o $(PROG) -ldl $(CFLAGS)
+	$(CC) $(LIB_SOURCES) src/main.c -o $(PROG) -ldl $(CFLAGS)
 
 mac: bsd
 bsd:
-	$(CC) $(LIB_SOURCES) main.c -o $(PROG) $(CFLAGS)
+	$(CC) $(LIB_SOURCES) src/main.c -o $(PROG) $(CFLAGS)
 
 bsd_lua: $(ALL_OBJECTS)
 	$(CC) $(ALL_OBJECTS) -o $@
 
 solaris:
-	$(CC) $(LIB_SOURCES) main.c -lnsl -lsocket -o $(PROG) $(CFLAGS)
+	$(CC) $(LIB_SOURCES) src/main.c -lnsl -lsocket -o $(PROG) $(CFLAGS)
 
 lib$(PROG).a: $(ALL_OBJECTS)
 	ar cr $@ $(ALL_OBJECTS)
@@ -146,14 +146,14 @@ $(PROG).lib: $(ALL_WINOBJS)
 # For codesign to work in non-interactive mode, unlock login keychain:
 # security unlock ~/Library/Keychains/login.keychain
 # See e.g. http://lists.apple.com/archives/apple-cdsa/2008/Jan/msg00027.html
-Civetweb: $(LIB_SOURCES) main.c
-	$(CC) $(LIB_SOURCES) main.c build/lsqlite3.c build/sqlite3.c \
+Civetweb: $(LIB_SOURCES) src/main.c
+	$(CC) $(LIB_SOURCES) src/main.c src/third_party/lsqlite3.c src/third_party/sqlite3.c \
           -DUSE_COCOA $(CFLAGS) $(FLAGS) -mmacosx-version-min=10.4 \
           $(YASSL_SOURCES) $(LUA_SOURCES) \
           -framework Cocoa -ObjC -arch i386 -arch x86_64 -o Civetweb
 
 cocoa: Civetweb
-	V=`perl -lne '/define\s+CIVETWEB_VERSION\s+"(\S+)"/ and print $$1' $(LIB_SOURCES)`; DIR=dmg/Civetweb.app && rm -rf $$DIR && mkdir -p $$DIR/Contents/{MacOS,Resources} && install -m 644 build/civetweb_*.png build/civetweb.icns $$DIR/Contents/Resources/ && install -m 644 build/Info.plist $$DIR/Contents/ && install -m 755 Civetweb $$DIR/Contents/MacOS/ && ln -fs /Applications dmg/ ; hdiutil create Civetweb_$$V.dmg -volname "Civetweb $$V" -srcfolder dmg -ov #; rm -rf dmg
+	V=`perl -lne '/define\s+CIVETWEB_VERSION\s+"(\S+)"/ and print $$1' $(LIB_SOURCES)`; DIR=dmg/Civetweb.app && rm -rf $$DIR && mkdir -p $$DIR/Contents/{MacOS,Resources} && install -m 644 resources/civetweb_*.png resources/civetweb.icns $$DIR/Contents/Resources/ && install -m 644 resources/Info.plist $$DIR/Contents/ && install -m 755 Civetweb $$DIR/Contents/MacOS/ && ln -fs /Applications dmg/ ; hdiutil create Civetweb_$$V.dmg -volname "Civetweb $$V" -srcfolder dmg -ov #; rm -rf dmg
 
 un:
 	$(CC) test/unit_test.c -o unit_test -I. -I$(LUA) $(LUA_SOURCES) \
@@ -167,18 +167,18 @@ wi:
 	./unit_test.exe
 
 windows: $(ALL_WINOBJS)
-	$(MSVC)/bin/rc build/res.rc
-	$(LINK) /nologo $(ALL_WINOBJS) build/res.res /out:$(PROG).exe
+	$(MSVC)/bin/rc resources/res.rc
+	$(LINK) /nologo $(ALL_WINOBJS) resources/res.res /out:$(PROG).exe
 
 # Build for Windows under MinGW
 #MINGWDBG= -DDEBUG -O0 -ggdb
 MINGWDBG= -DNDEBUG -Os
 MINGWOPT=  -W -Wall -mthreads -Wl,--subsystem,console $(MINGWDBG) -DHAVE_STDINT $(GCC_WARNINGS) $(COPT)
 mingw:
-	windres build\res.rc build\res.o
+	windres resources\res.rc resources\res.o
 	$(CC) $(MINGWOPT) $(LIB_SOURCES) -lws2_32 \
 		-shared -Wl,--out-implib=$(PROG).lib -o $(PROG).dll
-	$(CC) $(MINGWOPT) $(LIB_SOURCES) main.c build\res.o \
+	$(CC) $(MINGWOPT) $(LIB_SOURCES) src/main.c resources\res.o \
 	-lws2_32 -ladvapi32 -lcomdlg32 -o $(PROG).exe
 
 # Build for Windows under Cygwin
@@ -186,24 +186,23 @@ mingw:
 CYGWINDBG= -DNDEBUG -Os
 CYGWINOPT=  -W -Wall -mthreads -Wl,--subsystem,console $(CYGWINDBG) -DHAVE_STDINT $(GCC_WARNINGS) $(COPT)
 cygwin:
-	windres ./build/res.rc ./build/res.o
+	windres ./resources/res.rc ./resources/res.o
 	$(CC) $(CYGWINOPT) $(LIB_SOURCES) -lws2_32 \
 		-shared -Wl,--out-implib=$(PROG).lib -o $(PROG).dll
-	$(CC) $(CYGWINOPT) -Ibuild $(LIB_SOURCES) main.c ./build/res.o \
+	$(CC) $(CYGWINOPT) -Iinclude $(LIB_SOURCES) src/main.c ./resources/res.o \
 	-lws2_32 -ladvapi32 -o $(PROG).exe
 
 tests:
 	perl test/test.pl $(TEST)
 
 tarball: clean
-	F=civetweb-`perl -lne '/define\s+CIVETWEB_VERSION\s+"(\S+)"/ and print $$1' $(LIB_SOURCES)`.tgz ; cd .. && tar -czf x civetweb/{LICENSE.md,Makefile,examples,test,build,*.[ch],*.md} && mv x civetweb/$$F
+	F=civetweb-`perl -lne '/define\s+CIVETWEB_VERSION\s+"(\S+)"/ and print $$1' $(LIB_SOURCES)`.tgz ; cd .. && tar -czf x civetweb/{LICENSE.md,Makefile,examples,test,resources,*.[ch],*.md} && mv x civetweb/$$F
 
 release: tarball cocoa
 	wine make windows
 	V=`perl -lne '/define\s+CIVETWEB_VERSION\s+"(\S+)"/ and print $$1' $(LIB_SOURCES)`; upx civetweb.exe; cp civetweb.exe civetweb-$$V.exe; cp civetweb.exe civetweb_php_bundle/; zip -r civetweb_php_bundle_$$V.zip civetweb_php_bundle/
 
 clean:
-	cd examples && $(MAKE) clean
 	rm -rf *.o *.core $(PROG) *.obj *.so $(PROG).txt *.dSYM *.tgz \
-	$(PROG).exe *.dll *.lib build/res.o build/res.RES *.dSYM *.zip *.pdb \
+	$(PROG).exe *.dll *.lib resources/res.o resources/res.RES *.dSYM *.zip *.pdb \
 	*.exe *.dmg $(ALL_OBJECTS) $(ALL_WINOBJS)

+ 3 - 3
Makefile.osx

@@ -18,15 +18,15 @@ CONTENTS_DIR = $(DMG_DIR)/$(PACKAGE).app/Contents
 RESOURCES_DIR = $(CONTENTS_DIR)/Resources
 OSXBIN_DIR = $(CONTENTS_DIR)/MacOS
 
-CIVETWEB_VERSION = $(shell perl -lne '/define\s+CIVETWEB_VERSION\s+"(\S+)"/ and print $$1' civetweb.c)
+CIVETWEB_VERSION = $(shell perl -lne '/define\s+CIVETWEB_VERSION\s+"(\S+)"/ and print $$1' src/civetweb.c)
 
 include Makefile
 
 package: build
 	@rm -rf $(DMG_DIR)
 	install -d -m 755 $(CONTENTS_DIR) $(RESOURCES_DIR) $(OSXBIN_DIR)
-	install -m 644 build/Info.plist $(CONTENTS_DIR)/
-	install -m 644 build/civetweb_*.png build/civetweb.icns $(RESOURCES_DIR)/
+	install -m 644 resources/Info.plist $(CONTENTS_DIR)/
+	install -m 644 resources/civetweb_*.png resources/civetweb.icns $(RESOURCES_DIR)/
 	install -m 755 $(CPROG) $(OSXBIN_DIR)/$(PACKAGE)
 	ln -fs /Applications $(DMG_DIR)/
 	hdiutil create $(PACKAGE)_$(CIVETWEB_VERSION).dmg -volname "$(PACKAGE) $(CIVETWEB_VERSION)" -srcfolder $(DMG_DIR) -ov

+ 1 - 1
README.md

@@ -18,7 +18,7 @@ https://groups.google.com/d/forum/civetweb
 
 # Quick start documentation
 
-- [ReleaseNotes.md](https://github.com/sunsetbrew/civetweb/blob/master/ReleaseNotes.md) - Release Notes
+- [RELEASE_NOTES.md](https://github.com/sunsetbrew/civetweb/blob/master/RELEASE_NOTES.md) - Release Notes
 - [docs/UserManual.md](https://github.com/sunsetbrew/civetweb/blob/master/docs/UserManual.md) - End User Guide
 - [docs/Building.md](https://github.com/sunsetbrew/civetweb/blob/master/docs/Building.md) - Buildiing the Server Quick Start
 - [docs/Embedding.md](https://github.com/sunsetbrew/civetweb/blob/master/docs/Embedding.md) - Embedding Quick Start

+ 3 - 2
ReleaseNotes.md → RELEASE_NOTES.md

@@ -6,11 +6,12 @@ The objective of this release is to establish a maintable code base, ensure MIT
 Changes
 -------
 
+- Reorangized build directories to make them more intuitive
 - Added new build rules for lib and slib with option to include C++ class
 - Upgraded LUA from 5.2.1 to 5.2.2
 - Added fallback configuration file path for Linux systems.
-    + Good for having a system wide default configuration /etc/civetweb/civetweb.conf
-- Added new C++ abstraction class cpp/CivetServer
+    + Good for having a system wide default configuration /usr/local/etc/civetweb.conf
+- Added new C++ abstraction class CivetServer
 - Added thread safety for and fixed websocket defects (Morgan McGuire)
 - Created PKGBUILD to use Arch distribution (Daniel Oaks)
 - Created new documentation on Embeddeding, Building and yaSSL (see docs/).

+ 7 - 10
VS2012/civetweb/civetweb.vcxproj

@@ -52,7 +52,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>$(ProjectDir)..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -68,7 +68,7 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>$(ProjectDir)..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -78,20 +78,17 @@
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
-    <ClCompile Include="..\..\civetweb.c" />
-    <ClCompile Include="..\..\main.c" />
+    <ClCompile Include="..\..\src\civetweb.c" />
+    <ClCompile Include="..\..\src\main.c" />
   </ItemGroup>
   <ItemGroup>
-    <Image Include="..\..\build\systray.ico" />
+    <Image Include="..\..\resources\systray.ico" />
   </ItemGroup>
   <ItemGroup>
-    <ResourceCompile Include="..\..\build\res.rc" />
+    <ResourceCompile Include="..\..\resources\res.rc" />
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="..\..\civetweb.h" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="..\..\md5.inl" />
+    <ClInclude Include="..\..\include\civetweb.h" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">

+ 5 - 10
VS2012/civetweb/civetweb.vcxproj.filters

@@ -15,31 +15,26 @@
     </Filter>
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="..\..\main.c">
+    <ClCompile Include="..\..\src\main.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\civetweb.c">
+    <ClCompile Include="..\..\src\civetweb.c">
       <Filter>Source Files</Filter>
     </ClCompile>
   </ItemGroup>
   <ItemGroup>
-    <Image Include="..\..\build\systray.ico">
+    <Image Include="..\..\resources\systray.ico">
       <Filter>Resource Files</Filter>
     </Image>
   </ItemGroup>
   <ItemGroup>
-    <ResourceCompile Include="..\..\build\res.rc">
+    <ResourceCompile Include="..\..\resources\res.rc">
       <Filter>Resource Files</Filter>
     </ResourceCompile>
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="..\..\civetweb.h">
+    <ClInclude Include="..\..\include\civetweb.h">
       <Filter>Header Files</Filter>
     </ClInclude>
   </ItemGroup>
-  <ItemGroup>
-    <None Include="..\..\md5.inl">
-      <Filter>Header Files</Filter>
-    </None>
-  </ItemGroup>
 </Project>

+ 10 - 14
VS2012/civetweb_lua/civetweb_lua.vcxproj

@@ -52,7 +52,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>LUA_COMPAT_ALL;USE_LUA;USE_LUA_SQLITE3;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>$(ProjectDir)..\..;$(ProjectDir)..\..\lua-5.2.2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)..\..\include;$(ProjectDir)..\..\src\third_party\lua-5.2.2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -68,7 +68,7 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>LUA_COMPAT_ALL;USE_LUA;USE_LUA_SQLITE3;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>$(ProjectDir)..\..;$(ProjectDir)..\..\lua-5.2.2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)..\..\include;$(ProjectDir)..\..\src\third_party\lua-5.2.2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -81,30 +81,26 @@
     <Text Include="ReadMe.txt" />
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="..\..\civetweb.h" />
-    <ClInclude Include="..\..\lua-5.2.2\src\lauxlib.h" />
-    <ClInclude Include="..\..\lua-5.2.2\src\lua.h" />
-    <ClInclude Include="Resource.h" />
+    <ClInclude Include="..\..\include\civetweb.h" />
+    <ClInclude Include="..\..\src\third_party\lua-5.2.2\src\lauxlib.h" />
+    <ClInclude Include="..\..\src\third_party\lua-5.2.2\src\lua.h" />
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="..\..\civetweb.c" />
-    <ClCompile Include="..\..\main.c" />
+    <ClCompile Include="..\..\src\civetweb.c" />
+    <ClCompile Include="..\..\src\main.c" />
   </ItemGroup>
   <ItemGroup>
-    <ResourceCompile Include="..\..\build\res.rc" />
+    <ResourceCompile Include="..\..\resources\res.rc" />
   </ItemGroup>
   <ItemGroup>
-    <Image Include="..\..\build\systray.ico" />
+    <Image Include="..\..\resources\systray.ico" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\lua_lib\lua_lib.vcxproj">
       <Project>{8f5e5d77-d269-4665-9e27-1045da6cf0d8}</Project>
     </ProjectReference>
   </ItemGroup>
-  <ItemGroup>
-    <None Include="..\..\md5.inl" />
-  </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
+</Project>

+ 8 - 16
VS2012/civetweb_lua/civetweb_lua.vcxproj.filters

@@ -18,40 +18,32 @@
     <Text Include="ReadMe.txt" />
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="Resource.h">
+    <ClInclude Include="..\..\include\civetweb.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\civetweb.h">
+    <ClInclude Include="..\..\src\third_party\lua-5.2.2\src\lua.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\lua-5.2.2\src\lua.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\lua-5.2.2\src\lauxlib.h">
+    <ClInclude Include="..\..\src\third_party\lua-5.2.2\src\lauxlib.h">
       <Filter>Header Files</Filter>
     </ClInclude>
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="..\..\civetweb.c">
+    <ClCompile Include="..\..\src\civetweb.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\main.c">
+    <ClCompile Include="..\..\src\main.c">
       <Filter>Source Files</Filter>
     </ClCompile>
   </ItemGroup>
   <ItemGroup>
-    <ResourceCompile Include="..\..\build\res.rc">
+    <ResourceCompile Include="..\..\resources\res.rc">
       <Filter>Resource Files</Filter>
     </ResourceCompile>
   </ItemGroup>
   <ItemGroup>
-    <Image Include="..\..\build\systray.ico">
+    <Image Include="..\..\resources\systray.ico">
       <Filter>Resource Files</Filter>
     </Image>
   </ItemGroup>
-  <ItemGroup>
-    <None Include="..\..\md5.inl">
-      <Filter>Header Files</Filter>
-    </None>
-  </ItemGroup>
-</Project>
+</Project>

+ 7 - 10
VS2012/civetweb_yassl/civetweb_yassl/civetweb_yassl.vcxproj

@@ -52,7 +52,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>USE_YASSL;NO_SSL_DL;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>$(ProjectDir)..\..\..\..\cyassl-2.7.0\;$(ProjectDir)..\..\..\..\cyassl-2.7.0\cyassl\</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)..\..\..\include;$(ProjectDir)..\..\..\..\cyassl-2.7.0\;$(ProjectDir)..\..\..\..\cyassl-2.7.0\cyassl\</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -68,7 +68,7 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>USE_YASSL;NO_SSL_DL;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>$(ProjectDir)..\..\..\..\cyassl-2.7.0\;$(ProjectDir)..\..\..\..\cyassl-2.7.0\cyassl\</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)..\..\..\include;$(ProjectDir)..\..\..\..\cyassl-2.7.0\;$(ProjectDir)..\..\..\..\cyassl-2.7.0\cyassl\</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -78,26 +78,23 @@
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
-    <ClInclude Include="..\..\..\civetweb.h" />
+    <ClInclude Include="..\..\..\include\civetweb.h" />
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="..\..\..\civetweb.c" />
-    <ClCompile Include="..\..\..\main.c" />
+    <ClCompile Include="..\..\..\src\civetweb.c" />
+    <ClCompile Include="..\..\..\src\main.c" />
   </ItemGroup>
   <ItemGroup>
-    <ResourceCompile Include="..\..\..\build\res.rc" />
+    <ResourceCompile Include="..\..\..\resources\res.rc" />
   </ItemGroup>
   <ItemGroup>
-    <Image Include="..\..\..\build\systray.ico" />
+    <Image Include="..\..\..\resources\systray.ico" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\yassl_lib\yassl_lib.vcxproj">
       <Project>{8c0c878b-bbd6-4241-bca6-61753ffcc7f1}</Project>
     </ProjectReference>
   </ItemGroup>
-  <ItemGroup>
-    <None Include="..\..\..\md5.inl" />
-  </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>

+ 5 - 10
VS2012/civetweb_yassl/civetweb_yassl/civetweb_yassl.vcxproj.filters

@@ -15,31 +15,26 @@
     </Filter>
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="..\..\..\civetweb.h">
+    <ClInclude Include="..\..\..\include\civetweb.h">
       <Filter>Header Files</Filter>
     </ClInclude>
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="..\..\..\civetweb.c">
+    <ClCompile Include="..\..\..\src\civetweb.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\..\main.c">
+    <ClCompile Include="..\..\..\src\main.c">
       <Filter>Source Files</Filter>
     </ClCompile>
   </ItemGroup>
   <ItemGroup>
-    <ResourceCompile Include="..\..\..\build\res.rc">
+    <ResourceCompile Include="..\..\..\resources\res.rc">
       <Filter>Resource Files</Filter>
     </ResourceCompile>
   </ItemGroup>
   <ItemGroup>
-    <Image Include="..\..\..\build\systray.ico">
+    <Image Include="..\..\..\resources\systray.ico">
       <Filter>Resource Files</Filter>
     </Image>
   </ItemGroup>
-  <ItemGroup>
-    <None Include="..\..\..\md5.inl">
-      <Filter>Header Files</Filter>
-    </None>
-  </ItemGroup>
 </Project>

+ 8 - 11
VS2012/ex_embed_cpp/ex_embed_cpp.vcxproj

@@ -52,7 +52,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>$(ProjectDir)..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Console</SubSystem>
@@ -68,7 +68,7 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>$(ProjectDir)..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Console</SubSystem>
@@ -78,18 +78,15 @@
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
-    <ClInclude Include="..\..\civetweb.h" />
-    <ClInclude Include="..\..\cpp\CivetServer.h" />
+    <ClInclude Include="..\..\include\civetweb.h" />
+    <ClInclude Include="..\..\include\CivetServer.h" />
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="..\..\civetweb.c" />
-    <ClCompile Include="..\..\cpp\CivetServer.cpp" />
-    <ClCompile Include="..\..\cpp\example.cpp" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="..\..\md5.inl" />
+    <ClCompile Include="..\..\src\civetweb.c" />
+    <ClCompile Include="..\..\src\CivetServer.cpp" />
+    <ClCompile Include="..\..\examples\embedded_cpp\embedded_cpp.cpp" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
+</Project>

+ 6 - 11
VS2012/ex_embed_cpp/ex_embed_cpp.vcxproj.filters

@@ -15,27 +15,22 @@
     </Filter>
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="..\..\civetweb.h">
+    <ClInclude Include="..\..\include\civetweb.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\cpp\CivetServer.h">
+    <ClInclude Include="..\..\include\CivetServer.h">
       <Filter>Header Files</Filter>
     </ClInclude>
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="..\..\cpp\example.cpp">
+    <ClCompile Include="..\..\examples\embedded_cpp\embedded_cpp.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\civetweb.c">
+    <ClCompile Include="..\..\src\civetweb.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\cpp\CivetServer.cpp">
+    <ClCompile Include="..\..\src\CivetServer.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
   </ItemGroup>
-  <ItemGroup>
-    <None Include="..\..\md5.inl">
-      <Filter>Header Files</Filter>
-    </None>
-  </ItemGroup>
-</Project>
+</Project>

+ 5 - 8
VS2012/ex_websocket/ex_websocket.vcxproj

@@ -52,7 +52,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>USE_WEBSOCKET;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>$(ProjectDir)..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Console</SubSystem>
@@ -68,7 +68,7 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>USE_WEBSOCKET;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>$(ProjectDir)..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Console</SubSystem>
@@ -78,14 +78,11 @@
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
-    <ClInclude Include="..\..\civetweb.h" />
+    <ClInclude Include="..\..\include\civetweb.h" />
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="..\..\civetweb.c" />
-    <ClCompile Include="..\..\examples\websocket.c" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="..\..\md5.inl" />
+    <ClCompile Include="..\..\src\civetweb.c" />
+    <ClCompile Include="..\..\examples\websocket\websocket.c" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">

+ 3 - 8
VS2012/ex_websocket/ex_websocket.vcxproj.filters

@@ -15,21 +15,16 @@
     </Filter>
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="..\..\civetweb.h">
+    <ClInclude Include="..\..\include\civetweb.h">
       <Filter>Header Files</Filter>
     </ClInclude>
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="..\..\examples\websocket.c">
+    <ClCompile Include="..\..\examples\websocket\websocket.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\civetweb.c">
+    <ClCompile Include="..\..\src\civetweb.c">
       <Filter>Source Files</Filter>
     </ClCompile>
   </ItemGroup>
-  <ItemGroup>
-    <None Include="..\..\md5.inl">
-      <Filter>Header Files</Filter>
-    </None>
-  </ItemGroup>
 </Project>

+ 37 - 37
VS2012/lua_lib/lua_lib.vcxproj

@@ -47,7 +47,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>LUA_COMPAT_ALL;THREADSAFE=1;SQLITE_ENABLE_FTS3;SQLITE_ENABLE_FTS3_PARENTHESIS;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>$(ProjectDir)..\..\lua-5.2.2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)..\..\src\third_party\lua-5.2.2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -63,7 +63,7 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>LUA_COMPAT_ALL;THREADSAFE=1;SQLITE_ENABLE_FTS3;SQLITE_ENABLE_FTS3_PARENTHESIS;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>$(ProjectDir)..\..\lua-5.2.2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)..\..\src\third_party\lua-5.2.2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -73,43 +73,43 @@
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
-    <ClCompile Include="..\..\lua-5.2.2\src\lapi.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\lauxlib.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\lbaselib.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\lbitlib.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\lcode.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\lcorolib.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\lctype.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\ldblib.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\ldebug.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\ldo.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\ldump.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\lfunc.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\lgc.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\linit.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\liolib.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\llex.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\lmathlib.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\lmem.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\loadlib.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\lobject.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\lopcodes.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\loslib.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\lparser.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\lstate.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\lstring.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\lstrlib.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\ltable.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\ltablib.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\ltm.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\lundump.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\lvm.c" />
-    <ClCompile Include="..\..\lua-5.2.2\src\lzio.c" />
-    <ClCompile Include="..\..\build\lsqlite3.c" />
-    <ClCompile Include="..\..\build\sqlite3.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lapi.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lauxlib.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lbaselib.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lbitlib.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lcode.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lcorolib.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lctype.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\ldblib.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\ldebug.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\ldo.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\ldump.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lfunc.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lgc.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\linit.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\liolib.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\llex.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lmathlib.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lmem.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\loadlib.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lobject.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lopcodes.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\loslib.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lparser.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lstate.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lstring.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lstrlib.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\ltable.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\ltablib.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\ltm.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lundump.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lvm.c" />
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lzio.c" />
+    <ClCompile Include="..\..\src\third_party\lsqlite3.c" />
+    <ClCompile Include="..\..\src\third_party\sqlite3.c" />
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="..\..\build\sqlite3.h" />
+    <ClInclude Include="..\..\src\third_party\sqlite3.h" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">

+ 35 - 35
VS2012/lua_lib/lua_lib.vcxproj.filters

@@ -15,111 +15,111 @@
     </Filter>
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="..\..\lua-5.2.2\src\lapi.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lapi.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\lcode.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lcode.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\lctype.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lctype.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\ldebug.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\ldebug.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\ldo.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\ldo.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\ldump.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\ldump.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\lfunc.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lfunc.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\lgc.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lgc.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\llex.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\llex.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\lmem.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lmem.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\lobject.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lobject.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\lopcodes.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lopcodes.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\lparser.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lparser.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\lstate.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lstate.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\lstring.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lstring.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\ltable.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\ltable.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\ltm.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\ltm.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\lundump.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lundump.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\lauxlib.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lauxlib.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\lbaselib.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lbaselib.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\lbitlib.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lbitlib.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\lcorolib.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lcorolib.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\lvm.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lvm.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\lzio.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lzio.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\ldblib.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\ldblib.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\linit.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\linit.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\liolib.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\liolib.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\lmathlib.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lmathlib.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\loadlib.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\loadlib.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\loslib.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\loslib.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\lstrlib.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\lstrlib.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\lua-5.2.2\src\ltablib.c">
+    <ClCompile Include="..\..\src\third_party\lua-5.2.2\src\ltablib.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\build\lsqlite3.c">
+    <ClCompile Include="..\..\src\third_party\lsqlite3.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\build\sqlite3.c">
+    <ClCompile Include="..\..\src\third_party\sqlite3.c">
       <Filter>Source Files</Filter>
     </ClCompile>
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="..\..\build\sqlite3.h">
+    <ClInclude Include="..\..\src\third_party\sqlite3.h">
       <Filter>Header Files</Filter>
     </ClInclude>
   </ItemGroup>

+ 0 - 50
build/ssl_cert.pem

@@ -1,50 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIEogIBAAKCAQEAwONaLOP7EdegqjRuQKSDXzvHmFMZfBufjhELhNjo5KsL4ieH
-hMSGCcSV6y32hzhqR5lvTViaQez+xhc58NZRu+OUgEhodRBW/vAOjpz/xdMz5HaC
-EhP3E9W1pkitVseS8B5rrgJo1BfCGai1fPav1nutPq2Kj7vMy24+g460Lonf6ln1
-di4aTIRtAqXtUU6RFpPJP35PkCXbTK65O8HJSxxt/XtfoezHCU5+UIwmZGYx46UB
-Wzg3IfK6bGPSiHU3pdiTol0uMPt/GUK+x4NyZJ4/ImsNAicRwMBdja4ywHKXJehH
-gXBthsVIHbL21x+4ibsg9eVM/XioTV6tW3IrdwIDAQABAoIBACFfdLutmkQFBcRN
-HAJNNHmmsyr0vcUOVnXTFyYeDXV67qxrYHQlOHe6LqIpKq1Mon7O2kYMnWvooFAP
-trOnsS6L+qaTYJdYg2TKjgo4ubw1hZXytyB/mdExuaMSkgMgtpia+tB5lD+V+LxN
-x1DesZ+veFMO3Zluyckswt4qM5yVa04YFrt31H0E1rJfIen61lidXIKYmHHWuRxK
-SadjFfbcqJ6P9ZF22BOkleg5Fm5NaxJmyQynOWaAkSZa5w1XySFfRjRfsbDr64G6
-+LSG8YtRuvfxnvUNhynVPHcpE40eiPo6v8Ho6yZKXpV5klCKciodXAORsswSoGJa
-N3nnu/ECgYEA6Yb2rM3QUEPIALdL8f/OzZ1GBSdiQB2WSAxzl9pR/dLF2H+0pitS
-to0830mk92ppVmRVD3JGxYDRZQ56tlFXyGaCzJBMRIcsotAhBoNbjV0i9n5bLJYf
-BmjU9yvWcgsTt0tr3B0FrtYyp2tCvwHqlxvFpFdUCj2oRw2uGpkhmNkCgYEA03M6
-WxFhsix3y6eVCVvShfbLBSOqp8l0qiTEty+dgVQcWN4CO/5eyaZXKxlCG9KMmKxy
-Yx+YgxZrDhfaZ0cxhHGPRKEAxM3IKwT2C8/wCaSiLWXZZpTifnSD99vtOt4wEfrG
-+AghNd5kamFiM9tU0AyvhJc2vdJFuXrfeC7ntM8CgYBGDA+t4cZcbRhu7ow/OKYF
-kulP3nJgHP/Y+LMrl3cEldZ2jEfZmCElVNQvfd2XwTl7injhOzvzPiKRF3jDez7D
-g8w0JAxceddvttJRK9GoY4l7OoeKpjUELSnEQkf+yUfOsTbXPXVY7jMfeNL6jE6b
-qN7t3qv8rmXtejMBE3G6cQKBgGR5W2BMiRSlxqKx1cKlrApV87BUe1HRCyuR3xuA
-d6Item7Lx1oEi7vb242yKdSYnpApWQ06xTh83Y/Ly87JaIEbiM0+h+P8OEIg0F1a
-iB+86AcUX1I8KseVy+Np0HbpfwP8GrFfA5DaRPK7pXMopEtby8cAJ1XZZaI1/ZvZ
-BebHAoGAcQU9WvCkT+nIp9FpXfBybYUsvgkaizMIqp66/l3GYgYAq8p1VLGvN4v5
-ec0dW58SJrCpqsM3NP78DtEzQf9OOsk+FsjBFzDU2RkeUreyt2/nQBj/2mN/+hEy
-hYN0Zii2yTb63jGxKY6gH1R/r9dL8kXaJmcZrfSa3AgywnteJWg=
------END RSA PRIVATE KEY-----
------BEGIN CERTIFICATE-----
-MIIDBjCCAe4CCQCX05m0b053QzANBgkqhkiG9w0BAQQFADBFMQswCQYDVQQGEwJB
-VTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0
-cyBQdHkgTHRkMB4XDTA4MTIwNzEwMjUyMloXDTE4MTIwNTEwMjUyMlowRTELMAkG
-A1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0
-IFdpZGdpdHMgUHR5IEx0ZDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
-AMDjWizj+xHXoKo0bkCkg187x5hTGXwbn44RC4TY6OSrC+Inh4TEhgnElest9oc4
-akeZb01YmkHs/sYXOfDWUbvjlIBIaHUQVv7wDo6c/8XTM+R2ghIT9xPVtaZIrVbH
-kvAea64CaNQXwhmotXz2r9Z7rT6tio+7zMtuPoOOtC6J3+pZ9XYuGkyEbQKl7VFO
-kRaTyT9+T5Al20yuuTvByUscbf17X6HsxwlOflCMJmRmMeOlAVs4NyHyumxj0oh1
-N6XYk6JdLjD7fxlCvseDcmSePyJrDQInEcDAXY2uMsBylyXoR4FwbYbFSB2y9tcf
-uIm7IPXlTP14qE1erVtyK3cCAwEAATANBgkqhkiG9w0BAQQFAAOCAQEAW4yZdqpB
-oIdiuXRosr86Sg9FiMg/cn+2OwQ0QIaA8ZBwKsc+wIIHEgXCS8J6316BGQeUvMD+
-plNe0r4GWzzmlDMdobeQ5arPRB89qd9skE6pAMdLg3FyyfEjz3A0VpskolW5VBMr
-P5R7uJ1FLgH12RyAjZCWYcCRqEMOffqvyMCH6oAjyDmQOA5IssRKX/HsHntSH/HW
-W7slTcP45ty1b44Nq22/ubYk0CJRQgqKOIQ3cLgPomN1jNFQbAbfVTaK1DpEysrQ
-5V8a8gNW+3sVZmV6d1Mj3pN2Le62wUKuV2g6BNU7iiwcoY8HI68aRxz2hVMS+t5f
-SEGI4JSxV56lYg==
------END CERTIFICATE-----
------BEGIN DH PARAMETERS-----
-MEYCQQD+ef8hZ4XbdoyIpJyCTF2UrUEfX6mYDvxuS5O1UNYcslUqlj6JkA11e/yS
-6DK8Z86W6mSj5CEk4IjbyEOECXH7AgEC
------END DH PARAMETERS-----

+ 0 - 127
cpp/CivetServer.cpp

@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 2013 No Face Press, LLC
- * License http://opensource.org/licenses/mit-license.php MIT License
- */
-
-#include "CivetServer.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-int CivetServer::begin_request_callback(struct mg_connection *conn) {
-	struct mg_request_info *request_info = mg_get_request_info(conn);
-
-	if (!request_info->user_data)
-		return 0;
-
-	CivetServer *me = (CivetServer*) (request_info->user_data);
-
-	if (me->handleRequest(conn)) {
-		return 1; // Mark as processed
-	}
-
-	return 0;
-}
-
-bool CivetServer::handleRequest(struct mg_connection *conn) {
-	struct mg_request_info *request_info = mg_get_request_info(conn);
-
-	CivetHandler *handler = getHandler(request_info->uri);
-	if (handler) {
-		if (strcmp(request_info->request_method, "GET") == 0) {
-			return handler->handleGet(this, conn);
-		} else if (strcmp(request_info->request_method, "POST") == 0) {
-			return handler->handlePost(this, conn);
-		} else if (strcmp(request_info->request_method, "PUT") == 0) {
-			return !handler->handlePost(this, conn);
-		} else if (strcmp(request_info->request_method, "DELETE") == 0) {
-			return !handler->handlePost(this, conn);
-		}
-	}
-
-	return false; // No handler found
-}
-
-CivetServer::CivetServer(const char **options,
-		const struct mg_callbacks *_callbacks) :
-		context(0) {
-
-	struct mg_callbacks callbacks;
-
-	if (_callbacks) {
-		memcpy(&callbacks, _callbacks, sizeof(callbacks));
-	} else {
-		memset(&callbacks, 0, sizeof(callbacks));
-	}
-	callbacks.begin_request = &begin_request_callback;
-
-	context = mg_start(&callbacks, this, options);
-}
-
-CivetServer::~CivetServer() {
-	close();
-}
-
-CivetHandler *CivetServer::getHandler(const char *uri, unsigned urilen) const {
-
-	for (unsigned index = 0; index < uris.size(); index++) {
-		const std::string &handlerURI = uris[index];
-
-		// first try for an exact match
-		if (handlerURI == uri) {
-			return handlers[index];
-		}
-
-		// next try for a partial match
-		// we will accept uri/something
-		if (handlerURI.length() < urilen
-				&& uri[handlerURI.length()] == '/'
-				&& handlerURI.compare(0, handlerURI.length(), uri, handlerURI.length()) == 0) {
-
-			return handlers[index];
-		}
-	}
-
-	return 0; // none found
-
-}
-
-void CivetServer::addHandler(const std::string &uri, CivetHandler *handler) {
-	int index = getIndex(uri);
-	if (index < 0) {
-		uris.push_back(uri);
-		handlers.push_back(handler);
-	} else if (handlers[index] != handler) {
-		delete handlers[index];
-		handlers[index] = handler;
-	}
-}
-
-void CivetServer::removeHandler(const std::string &uri) {
-	int index = getIndex(uri);
-	if (index >= 0) {
-		uris.erase(uris.begin() + index, uris.begin() + index + 1);
-		handlers.erase(handlers.begin() + index, handlers.begin() + index + 1);
-	}
-}
-
-int CivetServer::getIndex(const std::string &uri) const {
-	for (unsigned index = 0; index < uris.size(); index++) {
-		if (uris[index].compare(uri) == 0)
-			return index;
-	}
-	return -1;
-}
-
-void CivetServer::close() {
-	if (context) {
-		mg_stop (context);
-		context = 0;
-	}
-	for (int i = handlers.size() - 1; i >= 0; i--) {
-		delete handlers[i];
-	}
-	handlers.clear();
-	uris.clear();
-
-}

+ 0 - 193
cpp/CivetServer.h

@@ -1,193 +0,0 @@
-/*
- * 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 "civetweb.h"
-#include <vector>
-#include <string>
-
-class CivetServer; // forward declaration
-
-/**
- * Basic interface for a URI request handler.  Handlers implementations
- * must be reentrant.
- */
-class CivetHandler {
-public:
-
-	/**
-	 * Destructor
-	 */
-	virtual ~CivetHandler() {
-	}
-
-	/**
-	 * Callback method for GET request.
-	 *
-	 * @param server - the calling server
-	 * @param conn - the connection information
-	 * @returns true if implemented, false otherwise
-	 */
-	virtual bool handleGet(CivetServer *server, struct mg_connection *conn) {
-		return false;
-	}
-
-	/**
-	 * Callback method for POST request.
-	 *
-	 * @param server - the calling server
-	 * @param conn - the connection information
-	 * @returns true if implemented, false otherwise
-	 */
-	virtual bool handlePost(CivetServer *server, struct mg_connection *conn) {
-		return false;
-	}
-
-	/**
-	 * Callback method for PUT request.
-	 *
-	 * @param server - the calling server
-	 * @param conn - the connection information
-	 * @returns true if implemented, false otherwise
-	 */
-	virtual bool handlePut(CivetServer *server, struct mg_connection *conn) {
-		return false;
-	}
-
-	/**
-	 * Callback method for DELETE request.
-	 *
-	 * @param server - the calling server
-	 * @param conn - the connection information
-	 * @returns true if implemented, false otherwise
-	 */
-	virtual bool handleDelete(CivetServer *server, struct mg_connection *conn) {
-		return false;
-	}
-
-};
-
-/**
- * CivetServer
- *
- * Basic class for embedded web server.  This has a URL mapping built-in.
- */
-class CivetServer {
-public:
-
-	/**
-	 * Constructor
-	 *
-	 * This automatically starts the sever.
-	 * It is good practice to call getContext() after this in case there
-	 * were errors starting the server.
-	 *
-	 * @param options - the web server options.
-	 * @param callbacks - optional web server callback methods.
-	 *    Note that this class overrides begin_request callback.
-	 */
-	CivetServer(const char **options, const struct mg_callbacks *callbacks = 0);
-
-	/**
-	 * Destructor
-	 */
-	virtual ~CivetServer();
-
-	/**
-	 * close()
-	 *
-	 * Stops server and frees resources.
-	 */
-	void close();
-
-	/**
-	 * getContext()
-	 *
-	 * @return the context or 0 if not running.
-	 */
-	const struct mg_context *getContext() const {
-		return context;
-	}
-
-	/**
-	 * addHandler(const std::string &, CivetHandler *)
-	 *
-	 * Adds a URI handler.  If there is existing URI handler, it will
-	 * be replaced with this one.  The handler is "owned" by this server
-	 * and will be deallocated with it.
-	 *
-	 * URI's are ordered and partcial URI's are supported. For example,
-	 * consider two URIs in order: /a/b and /a; /a matches
-	 *  /a, /a/b matches /a/b, /a/c matches /a.  Reversing the order to
-	 *  /a and /a/b; /a matches /a/b, /a/b matches /a. /a/c matches /a.
-	 *
-	 *  @param uri - URI to match.
-	 *  @param handler - handler instance to use.  This will be free'ed
-	 *      when the server closes and instances cannot be reused.
-	 */
-	void addHandler(const std::string &uri, CivetHandler *handler);
-
-	/**
-	 * removeHandler(const std::string &)
-	 *
-	 * Removes a handler, deleting it if found.
-	 *
-	 * @param - the exact URL used in addHandler().
-	 */
-	void removeHandler(const std::string &uri);
-
-	/**
-	 * getHandler(const std::string &uri)
-	 *
-	 * @param uri - the URI
-	 * @returns the handler that matches the requested URI or 0 if none were found.
-	 */
-	CivetHandler *getHandler(const std::string &uri) const {
-		return getHandler(uri.data(), uri.length());
-	}
-
-	/**
-	 * getHandler(const char *uri, unsigned urilen)
-	 *
-	 * @param uri - the URI
-	 * @param urilen - the length of the URI
-	 * @returns the handler that matches the requested URI or 0 if none were found.
-	 */
-	CivetHandler *getHandler(const char *uri, unsigned urilen) const;
-
-protected:
-
-	/**
-	 * handleRequest(struct mg_connection *)
-	 *
-	 * Handles the incomming request.
-	 *
-	 * @param conn - the connection information
-	 * @returns true if implemented, false otherwise
-	 */
-	virtual bool handleRequest(struct mg_connection *conn);
-
-	/**
-	 *  Returns the index of the handler that matches the
-	 *  URI exactly.
-	 *
-	 *  @param uri - the url to match
-	 */
-	int getIndex(const std::string &uri) const;
-
-	std::vector<std::string> uris;
-	std::vector<CivetHandler *> handlers;
-	struct mg_context *context;
-
-private:
-	static int begin_request_callback(struct mg_connection *conn);
-
-};
-
-#endif /*  __cplusplus */
-#endif /* _CIVETWEB_SERVER_H_ */

+ 0 - 23
cpp/Makefile

@@ -1,23 +0,0 @@
-# 
-# Copyright (c) 2013 No Face Press, LLC
-# License http://opensource.org/licenses/mit-license.php MIT License
-#
-
-CFLAGS=	-W -Wall -Wno-unused-parameter -I.. -I. -g
-LIB_SOURCES = CivetServer.cpp ../civetweb.c ../md5.c
-LIBS = -lpthread 
-
-all:
-	$(CXX) $(CFLAGS) example.cpp $(LIB_SOURCES) $(LIBS) -o example;
-
-MSVC    = e:/vc6
-CL      = $(MSVC)/bin/cl
-CLFLAGS = /MD /TC /nologo $(DBG) /W3 /DNO_SSL \
-        /I$(MSVC)/include /I.. /I. /Dsnprintf=_snprintf \
-        /link /incremental:no /libpath:$(MSVC)/lib /machine:IX86
-
-windows:
-	$(CL) example.cpp $(LIB_SOURCES) $(CLFLAGS)
-
-clean:
-	rm -rf example *.exe *.dSYM *.obj

+ 7 - 3
docs/Building.md

@@ -38,12 +38,16 @@ Install on the system, Linux only.
 
 ```
 make lib WITH_CPP=1 WITH_IPV6=1
-make slib WITH_CPP=1 WITH_LUA=1 WITH_WEBSOCKET=1
+make clean slib WITH_CPP=1 WITH_LUA=1 WITH_WEBSOCKET=1
 ```
 Build the static and shared libraries.
 The *WITH_CPP* make option is to include the CivetServer class.
 The additional make options configure the library just as it would the application.
 
+The *slib* option should be done on a separate clean build as position
+independent code (PIC) is required for it.  Trying to run it after
+building the static library or the server will result in a link error.
+
 ```
 make clean
 ```
@@ -90,7 +94,7 @@ make build COPT="-DNDEBUG -DNO_CGI"
 
 Take total control with *CC*, *COPTS* and *TARGET_OS* as make options.
 TARGET_OS is used to determine some compile details as will as code function.
-TARGET_OS values should be be one found in *build/Makefile.in-os*.
+TARGET_OS values should be be one found in *resources/Makefile.in-os*.
 
 ```
 make CC=arm-none-linux-gnueabi-gcc COPT="-march=armv7-a  -mfpu=vfp -mfloat-abi=softfp" TARGET_OS=FROG
@@ -119,7 +123,7 @@ Note : You dont need root access to run civetweb 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-civetweb/build`
+- Run `/path-to-ndk/ndk-build -C /path-to-civetweb/resources`
   That should generate civetweb/lib/armeabi/civetweb
 - Using the adb tool (you need to have Android SDK installed for that),
   push the generated civetweb binary to `/data/local` folder on device.

+ 12 - 12
docs/Embedding.md

@@ -15,20 +15,20 @@ The *INL* file extension represents code that is statically included inline in a
 #### Required Files
 
   1. HTTP Server API
-    - civetweb.c
-    - civetweb.h
+    - src/civetweb.c
+    - include/civetweb.h
   2. MD5 API
-    - md5.inl
+    - src/md5.inl
   3. C++ Wrapper (Optional)
-    - cpp/CivetServer.cpp
-    - cpp/CivetServer.h
+    - src/CivetServer.cpp
+    - include/CivetServer.h
 
 #### Other Files
 
   1. Reference C Server
-    - main.c
+    - src/main.c
   2. Reference C++ Server
-    - cpp/example.cpp
+    - examples/embedded_cpp/embedded_cpp.cpp
 
 Quick Start
 ------
@@ -61,8 +61,8 @@ LUA is a server side include functionality.  Files ending in .la will be process
 
 ##### Add the following sources
 
-  - mod_lua.inl
-  - lua-5.2.2/src
+  - src/mod_lua.inl
+  - src/third_party/lua-5.2.2/src
      + lapi.c
      + lauxlib.c
      + lbaselib.c
@@ -95,9 +95,9 @@ LUA is a server side include functionality.  Files ending in .la will be process
      + lundump.c
      + lvm.c
      + lzio.c
-  - build/sqlite3.c
-  - build/sqlite3.h
-  - build/lsqlite3.c
+  - src/third_party/sqlite3.c
+  - src/third_party/sqlite3.h
+  - src/third_party/lsqlite3.c
 
 
 Civetweb internals

+ 3 - 3
docs/UserManual.md

@@ -258,7 +258,7 @@ directory is commonly referenced as dot (`.`).
 Path to SSL certificate file. This option is only required when at least one
 of the `listening_ports` is SSL. The file must be in PEM format,
 and it must have both private key and certificate, see for example
-[ssl_cert.pem](https://github.com/sunsetbrew/civetweb/blob/master/build/ssl_cert.pem)
+[ssl_cert.pem](https://github.com/sunsetbrew/civetweb/blob/master/resources/ssl_cert.pem)
 
 ### num_threads `50`
 Number of worker threads. Civetweb handles each incoming connection in a
@@ -332,10 +332,10 @@ are accessible from the Lua code (please check reference manual for details),
 and also information about the request is available in `mg.request_info` object,
 like request method, all headers, etcetera. Please refer to
 `struct mg_request_info` definition in
-[civetweb.h](https://github.com/sunsetbrew/civetweb/blob/master/civetweb.h)
+[civetweb.h](https://github.com/sunsetbrew/civetweb/blob/master/include/civetweb.h)
 to see what kind of information is present in `mg.request_info` object. Also,
 [page.lp](https://github.com/sunsetbrew/civetweb/blob/master/test/page.lp) and
-[prime_numbers.lp](https://github.com/sunsetbrew/civetweb/blob/master/examples/lua/prime_numbers.lp)
+[prime_numbers.lp](https://github.com/sunsetbrew/civetweb/blob/master/examples/docroot/prime_numbers.lp)
 contains some example code that uses `request_info` and other functions(form submitting for example).
 
 Civetweb exports the following to the Lua server page:

+ 0 - 26
examples/Makefile

@@ -1,26 +0,0 @@
-CFLAGS=	-W -Wall -I.. -pthread -g
-LIB_SOURCE =  ../civetweb.c
-all:
-	OS=`uname`; \
-	  test "$$OS" = Linux && LIBS="-ldl" ; \
-	  $(CC) $(CFLAGS) hello.c $(LIB_SOURCE) $$LIBS $(ADD) -o hello;
-	  $(CC) $(CFLAGS) upload.c $(LIB_SOURCE) $$LIBS $(ADD) -o upload;
-	  $(CC) $(CFLAGS) post.c $(LIB_SOURCE) $$LIBS $(ADD) -o post;
-	  $(CC) $(CFLAGS) -DUSE_WEBSOCKET websocket.c $(LIB_SOURCE) $$LIBS $(ADD) -o websocket;
-	  $(CC) $(CFLAGS) chat.c $(LIB_SOURCE) $$LIBS $(ADD) -o chat
-
-
-MSVC    = e:/vc6
-CL      = $(MSVC)/bin/cl
-CLFLAGS = /MD /TC /nologo $(DBG) /W3 /DNO_SSL \
-        /I$(MSVC)/include /I.. /Dsnprintf=_snprintf \
-        /link /incremental:no /libpath:$(MSVC)/lib /machine:IX86
-
-windows:
-	$(CL) upload.c $(LIB_SOURCE) $(CLFLAGS)
-	$(CL) hello.c $(LIB_SOURCE) $(CLFLAGS)
-	$(CL) post.c $(LIB_SOURCE) $(CLFLAGS)
-	$(CL) /DUSE_WEBSOCKET websocket.c $(LIB_SOURCE) $(CLFLAGS)
-
-clean:
-	rm -rf hello upload post websocket chat *.exe *.dSYM *.obj

+ 40 - 0
examples/chat/Makefile

@@ -0,0 +1,40 @@
+# 
+# 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 = chat
+SRC = chat.c
+
+TOP = ../..
+CIVETWEB_LIB = libcivetweb.a
+SSL_CERT = ssl_cert.pem
+
+CFLAGS = -I$(TOP)/include $(COPT)
+LIBS = -lpthread
+
+include $(TOP)/resources/Makefile.in-os
+
+ifeq ($(TARGET_OS),LINUX) 
+	LIBS += -ldl
+endif
+
+all: $(PROG) $(SSL_CERT)
+
+$(PROG): $(CIVETWEB_LIB) $(SRC)
+	$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(SRC) $(CIVETWEB_LIB) $(LIBS)
+
+$(CIVETWEB_LIB):
+	$(MAKE) -C $(TOP) clean lib
+	cp $(TOP)/$(CIVETWEB_LIB) .
+
+$(SSL_CERT):
+	cp $(TOP)/resources/$(SSL_CERT) .
+
+clean:
+	rm -f $(CIVETWEB_LIB) $(PROG) $(SSL_CERT)
+
+.PHONY: all clean

+ 0 - 0
examples/chat.c → examples/chat/chat.c


+ 0 - 0
examples/html/favicon.ico → examples/docroot/favicon.ico


+ 0 - 0
examples/html/index.html → examples/docroot/index.html


+ 0 - 0
examples/html/jquery.js → examples/docroot/jquery.js


+ 0 - 0
examples/html/login.html → examples/docroot/login.html


+ 0 - 0
examples/html/logo.png → examples/docroot/logo.png


+ 0 - 0
examples/html/main.js → examples/docroot/main.js


+ 0 - 0
examples/lua/prime_numbers.lp → examples/docroot/prime_numbers.lp


+ 0 - 0
examples/html/style.css → examples/docroot/style.css


+ 36 - 0
examples/embedded_cpp/Makefile

@@ -0,0 +1,36 @@
+# 
+# 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

+ 0 - 0
cpp/example.cpp → examples/embedded_cpp/embedded_cpp.cpp


+ 36 - 0
examples/hello/Makefile

@@ -0,0 +1,36 @@
+# 
+# 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 = hello
+SRC = hello.c
+
+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)
+	$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(SRC) $(CIVETWEB_LIB) $(LIBS)
+
+$(CIVETWEB_LIB):
+	$(MAKE) -C $(TOP) clean lib
+	cp $(TOP)/$(CIVETWEB_LIB) .
+
+clean:
+	rm -f $(CIVETWEB_LIB) $(PROG)
+
+.PHONY: all clean

+ 0 - 0
examples/hello.c → examples/hello/hello.c


+ 0 - 0
examples/lua_dll.c → examples/lua/lua_dll.c


+ 36 - 0
examples/post/Makefile

@@ -0,0 +1,36 @@
+# 
+# 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 = post
+SRC = post.c
+
+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)
+	$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(SRC) $(CIVETWEB_LIB) $(LIBS)
+
+$(CIVETWEB_LIB):
+	$(MAKE) -C $(TOP) clean lib
+	cp $(TOP)/$(CIVETWEB_LIB) .
+
+clean:
+	rm -f $(CIVETWEB_LIB) $(PROG)
+
+.PHONY: all clean

+ 0 - 0
examples/post.c → examples/post/post.c


+ 36 - 0
examples/upload/Makefile

@@ -0,0 +1,36 @@
+# 
+# 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 = upload
+SRC = upload.c
+
+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)
+	$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(SRC) $(CIVETWEB_LIB) $(LIBS)
+
+$(CIVETWEB_LIB):
+	$(MAKE) -C $(TOP) clean lib
+	cp $(TOP)/$(CIVETWEB_LIB) .
+
+clean:
+	rm -f $(CIVETWEB_LIB) $(PROG)
+
+.PHONY: all clean

+ 0 - 0
examples/upload.c → examples/upload/upload.c


+ 36 - 0
examples/websocket/Makefile

@@ -0,0 +1,36 @@
+# 
+# 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 = websocket
+SRC = websocket.c
+
+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)
+	$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(SRC) $(CIVETWEB_LIB) $(LIBS)
+
+$(CIVETWEB_LIB):
+	$(MAKE) -C $(TOP) clean lib WITH_WEBSOCKET=1
+	cp $(TOP)/$(CIVETWEB_LIB) .
+
+clean:
+	rm -f $(CIVETWEB_LIB) $(PROG)
+
+.PHONY: all clean

+ 0 - 0
examples/websocket_html_root/index.html → examples/websocket/docroot/index.html


+ 0 - 0
examples/websocket.c → examples/websocket/websocket.c


+ 185 - 0
include/CivetServer.h

@@ -0,0 +1,185 @@
+/*
+ * 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 "civetweb.h"
+#include <vector>
+#include <string>
+
+class CivetServer; // forward declaration
+
+/**
+ * Basic interface for a URI request handler.  Handlers implementations
+ * must be reentrant.
+ */
+class CivetHandler {
+public:
+
+    /**
+     * Destructor
+     */
+    virtual ~CivetHandler() {
+    }
+
+    /**
+     * Callback method for GET request.
+     *
+     * @param server - the calling server
+     * @param conn - the connection information
+     * @returns true if implemented, false otherwise
+     */
+    virtual bool handleGet(CivetServer *server, struct mg_connection *conn);
+
+    /**
+     * Callback method for POST request.
+     *
+     * @param server - the calling server
+     * @param conn - the connection information
+     * @returns true if implemented, false otherwise
+     */
+    virtual bool handlePost(CivetServer *server, struct mg_connection *conn);
+
+    /**
+     * Callback method for PUT request.
+     *
+     * @param server - the calling server
+     * @param conn - the connection information
+     * @returns true if implemented, false otherwise
+     */
+    virtual bool handlePut(CivetServer *server, struct mg_connection *conn);
+
+    /**
+     * Callback method for DELETE request.
+     *
+     * @param server - the calling server
+     * @param conn - the connection information
+     * @returns true if implemented, false otherwise
+     */
+    virtual bool handleDelete(CivetServer *server, struct mg_connection *conn);
+
+};
+
+/**
+ * CivetServer
+ *
+ * Basic class for embedded web server.  This has a URL mapping built-in.
+ */
+class CivetServer {
+public:
+
+    /**
+     * Constructor
+     *
+     * This automatically starts the sever.
+     * It is good practice to call getContext() after this in case there
+     * were errors starting the server.
+     *
+     * @param options - the web server options.
+     * @param callbacks - optional web server callback methods.
+     *    Note that this class overrides begin_request callback.
+     */
+    CivetServer(const char **options, const struct mg_callbacks *callbacks = 0);
+
+    /**
+     * Destructor
+     */
+    virtual ~CivetServer();
+
+    /**
+     * close()
+     *
+     * Stops server and frees resources.
+     */
+    void close();
+
+    /**
+     * getContext()
+     *
+     * @return the context or 0 if not running.
+     */
+    const struct mg_context *getContext() const {
+        return context;
+    }
+
+    /**
+     * addHandler(const std::string &, CivetHandler *)
+     *
+     * Adds a URI handler.  If there is existing URI handler, it will
+     * be replaced with this one.  The handler is "owned" by this server
+     * and will be deallocated with it.
+     *
+     * URI's are ordered and partcial URI's are supported. For example,
+     * consider two URIs in order: /a/b and /a; /a matches
+     *  /a, /a/b matches /a/b, /a/c matches /a.  Reversing the order to
+     *  /a and /a/b; /a matches /a/b, /a/b matches /a. /a/c matches /a.
+     *
+     *  @param uri - URI to match.
+     *  @param handler - handler instance to use.  This will be free'ed
+     *      when the server closes and instances cannot be reused.
+     */
+    void addHandler(const std::string &uri, CivetHandler *handler);
+
+    /**
+     * removeHandler(const std::string &)
+     *
+     * Removes a handler, deleting it if found.
+     *
+     * @param - the exact URL used in addHandler().
+     */
+    void removeHandler(const std::string &uri);
+
+    /**
+     * getHandler(const std::string &uri)
+     *
+     * @param uri - the URI
+     * @returns the handler that matches the requested URI or 0 if none were found.
+     */
+    CivetHandler *getHandler(const std::string &uri) const {
+        return getHandler(uri.data(), uri.length());
+    }
+
+    /**
+     * getHandler(const char *uri, unsigned urilen)
+     *
+     * @param uri - the URI
+     * @param urilen - the length of the URI
+     * @returns the handler that matches the requested URI or 0 if none were found.
+     */
+    CivetHandler *getHandler(const char *uri, unsigned urilen) const;
+
+protected:
+
+    /**
+     * handleRequest(struct mg_connection *)
+     *
+     * Handles the incomming request.
+     *
+     * @param conn - the connection information
+     * @returns true if implemented, false otherwise
+     */
+    virtual bool handleRequest(struct mg_connection *conn);
+
+    /**
+     *  Returns the index of the handler that matches the
+     *  URI exactly.
+     *
+     *  @param uri - the url to match
+     */
+    int getIndex(const std::string &uri) const;
+
+    std::vector<std::string> uris;
+    std::vector<CivetHandler *> handlers;
+    struct mg_context *context;
+
+private:
+    static int begin_request_callback(struct mg_connection *conn);
+
+};
+
+#endif /*  __cplusplus */
+#endif /* _CIVETWEB_SERVER_H_ */

+ 1 - 1
civetweb.h → include/civetweb.h

@@ -190,7 +190,7 @@ const char **mg_get_valid_option_names(void);
 // This function allows an application to manipulate .htpasswd files on the
 // fly by adding, deleting and changing user records. This is one of the
 // several ways of implementing authentication on the server side. For another,
-// cookie-based way please refer to the examples/chat.c in the source tree.
+// cookie-based way please refer to the examples/chat in the source tree.
 //
 // If password is not NULL, entry is added (or modified if already exists).
 // If password is NULL, entry is deleted.

+ 0 - 0
build/Info.plist → resources/Info.plist


+ 2 - 2
build/Makefile.in-lua → resources/Makefile.in-lua

@@ -3,7 +3,7 @@
 # License http://opensource.org/licenses/mit-license.php MIT License
 #
 
-LUA_DIR = lua-5.2.2/src
+LUA_DIR = src/third_party/lua-5.2.2/src
 
 LUA_SOURCE_FILES = lapi.c  \
     lauxlib.c \
@@ -42,7 +42,7 @@ LUA_SOURCES = $(addprefix $(LUA_DIR)/, $(LUA_SOURCE_FILES))
 LUA_OBJECTS = $(LUA_SOURCES:.c=.o)
 LUA_CFLAGS = -I$(LUA_DIR) -DLUA_COMPAT_ALL
 
-SQLITE_DIR = build
+SQLITE_DIR = src/third_party
 SQLITE_SOURCE_FILES = sqlite3.c lsqlite3.c
 SQLITE_SOURCES = $(addprefix $(SQLITE_DIR)/, $(SQLITE_SOURCE_FILES))
 SQLITE_OBJECTS = $(SQLITE_SOURCES:.c=.o)

+ 0 - 0
build/Makefile.in-os → resources/Makefile.in-os


+ 0 - 0
build/civetweb.icns → resources/civetweb.icns


+ 0 - 0
build/civetweb.psd → resources/civetweb.psd


+ 0 - 0
build/civetweb_16x16.png → resources/civetweb_16x16.png


+ 0 - 0
build/civetweb_16x16@2.png → resources/civetweb_16x16@2.png


+ 0 - 0
build/civetweb_22x22.png → resources/civetweb_22x22.png


+ 0 - 0
build/civetweb_22x22@2.png → resources/civetweb_22x22@2.png


+ 0 - 0
build/civetweb_32x32.png → resources/civetweb_32x32.png


+ 0 - 0
build/civetweb_32x32@2.png → resources/civetweb_32x32@2.png


+ 0 - 0
build/civetweb_64x64.png → resources/civetweb_64x64.png


+ 0 - 0
build/civetweb_64x64@2.png → resources/civetweb_64x64@2.png


+ 0 - 0
build/dll.def → resources/dll.def


+ 1 - 1
build/jni/Android.mk → resources/jni/Android.mk

@@ -2,5 +2,5 @@ LOCAL_PATH := $(call my-dir)/../..
 include $(CLEAR_VARS)
 LOCAL_CFLAGS    := -std=c99 -O2 -W -Wall -pthread -pipe $(COPT)
 LOCAL_MODULE    := civetweb
-LOCAL_SRC_FILES := main.c civetweb.c
+LOCAL_SRC_FILES := src\main.c src\civetweb.c
 include $(BUILD_EXECUTABLE)

+ 0 - 0
build/res.rc → resources/res.rc


+ 0 - 0
examples/ssl_cert.pem → resources/ssl_cert.pem


+ 0 - 0
build/systray.ico → resources/systray.ico


+ 155 - 0
src/CivetServer.cpp

@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2013 No Face Press, LLC
+ * License http://opensource.org/licenses/mit-license.php MIT License
+ */
+
+#include "CivetServer.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef UNUSED_PARAMETER
+ #define UNUSED_PARAMETER(x) (void)(x)
+#endif
+
+bool CivetHandler::handleGet(CivetServer *server, struct mg_connection *conn) {
+    UNUSED_PARAMETER(server);
+    UNUSED_PARAMETER(conn);
+    return false;
+}
+
+bool CivetHandler::handlePost(CivetServer *server, struct mg_connection *conn) {
+    UNUSED_PARAMETER(server);
+    UNUSED_PARAMETER(conn);
+    return false;
+}
+
+bool CivetHandler::handlePut(CivetServer *server, struct mg_connection *conn) {
+    UNUSED_PARAMETER(server);
+    UNUSED_PARAMETER(conn);
+    return false;
+}
+
+bool CivetHandler::handleDelete(CivetServer *server, struct mg_connection *conn) {
+    UNUSED_PARAMETER(server);
+    UNUSED_PARAMETER(conn);
+    return false;
+}
+
+int CivetServer::begin_request_callback(struct mg_connection *conn) {
+    struct mg_request_info *request_info = mg_get_request_info(conn);
+
+    if (!request_info->user_data)
+        return 0;
+
+    CivetServer *me = (CivetServer*) (request_info->user_data);
+
+    if (me->handleRequest(conn)) {
+        return 1; // Mark as processed
+    }
+
+    return 0;
+}
+
+bool CivetServer::handleRequest(struct mg_connection *conn) {
+    struct mg_request_info *request_info = mg_get_request_info(conn);
+
+    CivetHandler *handler = getHandler(request_info->uri);
+    if (handler) {
+        if (strcmp(request_info->request_method, "GET") == 0) {
+            return handler->handleGet(this, conn);
+        } else if (strcmp(request_info->request_method, "POST") == 0) {
+            return handler->handlePost(this, conn);
+        } else if (strcmp(request_info->request_method, "PUT") == 0) {
+            return !handler->handlePost(this, conn);
+        } else if (strcmp(request_info->request_method, "DELETE") == 0) {
+            return !handler->handlePost(this, conn);
+        }
+    }
+
+    return false; // No handler found
+}
+
+CivetServer::CivetServer(const char **options,
+        const struct mg_callbacks *_callbacks) :
+        context(0) {
+
+    struct mg_callbacks callbacks;
+
+    if (_callbacks) {
+        memcpy(&callbacks, _callbacks, sizeof(callbacks));
+    } else {
+        memset(&callbacks, 0, sizeof(callbacks));
+    }
+    callbacks.begin_request = &begin_request_callback;
+
+    context = mg_start(&callbacks, this, options);
+}
+
+CivetServer::~CivetServer() {
+    close();
+}
+
+CivetHandler *CivetServer::getHandler(const char *uri, unsigned urilen) const {
+
+    for (unsigned index = 0; index < uris.size(); index++) {
+        const std::string &handlerURI = uris[index];
+
+        // first try for an exact match
+        if (handlerURI == uri) {
+            return handlers[index];
+        }
+
+        // next try for a partial match
+        // we will accept uri/something
+        if (handlerURI.length() < urilen
+                && uri[handlerURI.length()] == '/'
+                && handlerURI.compare(0, handlerURI.length(), uri, handlerURI.length()) == 0) {
+
+            return handlers[index];
+        }
+    }
+
+    return 0; // none found
+
+}
+
+void CivetServer::addHandler(const std::string &uri, CivetHandler *handler) {
+    int index = getIndex(uri);
+    if (index < 0) {
+        uris.push_back(uri);
+        handlers.push_back(handler);
+    } else if (handlers[index] != handler) {
+        delete handlers[index];
+        handlers[index] = handler;
+    }
+}
+
+void CivetServer::removeHandler(const std::string &uri) {
+    int index = getIndex(uri);
+    if (index >= 0) {
+        uris.erase(uris.begin() + index, uris.begin() + index + 1);
+        handlers.erase(handlers.begin() + index, handlers.begin() + index + 1);
+    }
+}
+
+int CivetServer::getIndex(const std::string &uri) const {
+    for (unsigned index = 0; index < uris.size(); index++) {
+        if (uris[index].compare(uri) == 0)
+            return index;
+    }
+    return -1;
+}
+
+void CivetServer::close() {
+    if (context) {
+        mg_stop (context);
+        context = 0;
+    }
+    for (int i = handlers.size() - 1; i >= 0; i--) {
+        delete handlers[i];
+    }
+    handlers.clear();
+    uris.clear();
+
+}

+ 0 - 0
civetweb.c → src/civetweb.c


+ 0 - 0
main.c → src/main.c


+ 0 - 0
md5.inl → src/md5.inl


+ 0 - 0
mod_lua.inl → src/mod_lua.inl


+ 0 - 0
build/lsqlite3.c → src/third_party/lsqlite3.c


+ 0 - 0
lua-5.2.2/Makefile → src/third_party/lua-5.2.2/Makefile


+ 0 - 0
lua-5.2.2/README → src/third_party/lua-5.2.2/README


+ 0 - 0
lua-5.2.2/doc/contents.html → src/third_party/lua-5.2.2/doc/contents.html


+ 0 - 0
lua-5.2.2/doc/logo.gif → src/third_party/lua-5.2.2/doc/logo.gif


+ 0 - 0
lua-5.2.2/doc/lua.1 → src/third_party/lua-5.2.2/doc/lua.1


+ 0 - 0
lua-5.2.2/doc/lua.css → src/third_party/lua-5.2.2/doc/lua.css


+ 0 - 0
lua-5.2.2/doc/luac.1 → src/third_party/lua-5.2.2/doc/luac.1


+ 0 - 0
lua-5.2.2/doc/manual.css → src/third_party/lua-5.2.2/doc/manual.css


+ 0 - 0
lua-5.2.2/doc/manual.html → src/third_party/lua-5.2.2/doc/manual.html


+ 0 - 0
lua-5.2.2/doc/osi-certified-72x60.png → src/third_party/lua-5.2.2/doc/osi-certified-72x60.png


+ 0 - 0
lua-5.2.2/doc/readme.html → src/third_party/lua-5.2.2/doc/readme.html


+ 0 - 0
lua-5.2.2/src/Makefile → src/third_party/lua-5.2.2/src/Makefile


+ 0 - 0
lua-5.2.2/src/lapi.c → src/third_party/lua-5.2.2/src/lapi.c


+ 0 - 0
lua-5.2.2/src/lapi.h → src/third_party/lua-5.2.2/src/lapi.h


+ 0 - 0
lua-5.2.2/src/lauxlib.c → src/third_party/lua-5.2.2/src/lauxlib.c


+ 0 - 0
lua-5.2.2/src/lauxlib.h → src/third_party/lua-5.2.2/src/lauxlib.h


+ 0 - 0
lua-5.2.2/src/lbaselib.c → src/third_party/lua-5.2.2/src/lbaselib.c


+ 0 - 0
lua-5.2.2/src/lbitlib.c → src/third_party/lua-5.2.2/src/lbitlib.c


+ 0 - 0
lua-5.2.2/src/lcode.c → src/third_party/lua-5.2.2/src/lcode.c


+ 0 - 0
lua-5.2.2/src/lcode.h → src/third_party/lua-5.2.2/src/lcode.h


+ 0 - 0
lua-5.2.2/src/lcorolib.c → src/third_party/lua-5.2.2/src/lcorolib.c


+ 0 - 0
lua-5.2.2/src/lctype.c → src/third_party/lua-5.2.2/src/lctype.c


+ 0 - 0
lua-5.2.2/src/lctype.h → src/third_party/lua-5.2.2/src/lctype.h


+ 0 - 0
lua-5.2.2/src/ldblib.c → src/third_party/lua-5.2.2/src/ldblib.c


+ 0 - 0
lua-5.2.2/src/ldebug.c → src/third_party/lua-5.2.2/src/ldebug.c


+ 0 - 0
lua-5.2.2/src/ldebug.h → src/third_party/lua-5.2.2/src/ldebug.h


+ 0 - 0
lua-5.2.2/src/ldo.c → src/third_party/lua-5.2.2/src/ldo.c


이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.