mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-26 12:14:56 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13d0b67c00 | ||
|
|
bda8e90733 | ||
|
|
fed2057a33 | ||
|
|
a27f62f89f | ||
|
|
d53902844c | ||
|
|
9870b80c65 | ||
|
|
cde25a8b82 | ||
|
|
1b7f036199 | ||
|
|
b80157b7ea | ||
|
|
f9311f0b30 | ||
|
|
bdd933f597 | ||
|
|
ee55d38b55 | ||
|
|
62162ff3e4 | ||
|
|
98f66c8867 | ||
|
|
c132191cad | ||
|
|
d73aa1ad09 | ||
|
|
d5bc58c38d | ||
|
|
51a80e4844 | ||
|
|
54f15a8fe3 | ||
|
|
ce0826e285 | ||
|
|
b21a8b2193 | ||
|
|
8bb49642da | ||
|
|
3f78df86ac | ||
|
|
c30f7a5258 | ||
|
|
7ed94d1918 | ||
|
|
dc513a9a15 | ||
|
|
8ce6cf61b7 | ||
|
|
e63f7fe33a | ||
|
|
b589e0cdf4 | ||
|
|
2b87f909ce | ||
|
|
ec7d0b1abd | ||
|
|
5bb3ede46d | ||
|
|
5105717f78 | ||
|
|
9d1e356709 | ||
|
|
3d7192d9fa | ||
|
|
1b3cbb17c1 | ||
|
|
f1f03e4378 | ||
|
|
625a2a3652 | ||
|
|
33a31d9308 | ||
|
|
5e9bd1f05e | ||
|
|
75d9a6c844 | ||
|
|
179761fd99 | ||
|
|
b783813e54 | ||
|
|
4b29689a42 | ||
|
|
9c4853471c | ||
|
|
81e21a3a0b | ||
|
|
bec6ea00ea | ||
|
|
ed32e3be0f | ||
|
|
83fae879bf | ||
|
|
2169e6d77f | ||
|
|
850e0a5922 | ||
|
|
322ed3cc6f | ||
|
|
6d4d53c247 | ||
|
|
e6f8d40942 | ||
|
|
7e051206ad | ||
|
|
76d913796c | ||
|
|
4c2609df2c | ||
|
|
f79bd71fd4 | ||
|
|
5d4f5b6000 | ||
|
|
fe7c245a6b | ||
|
|
f24bebaca8 | ||
|
|
08afdfa8b6 | ||
|
|
05f7d65fc9 | ||
|
|
a194e07545 | ||
|
|
dbb8a5bbf4 | ||
|
|
d3005df019 | ||
|
|
ef9b103a00 | ||
|
|
f0a2924a7c | ||
|
|
f109030cd0 | ||
|
|
eebdd06532 | ||
|
|
ca2fc71a01 | ||
|
|
e61e371c16 | ||
|
|
d5f07f5b9b | ||
|
|
0a8d5dde51 | ||
|
|
5646caa572 | ||
|
|
c7e5573d08 | ||
|
|
b9a226d109 | ||
|
|
fcf8b86288 | ||
|
|
a8b08c6784 | ||
|
|
1fb6f391a1 | ||
|
|
fcbc36ecde | ||
|
|
70771f29ce | ||
|
|
121391504f | ||
|
|
8455742440 | ||
|
|
5b786a5089 | ||
|
|
a6e74e7707 | ||
|
|
acf72a6109 | ||
|
|
2b76f5fc2a | ||
|
|
c0150606f0 | ||
|
|
cdb6588973 | ||
|
|
eecf24b20c | ||
|
|
0470e813a9 | ||
|
|
52c2b6a407 | ||
|
|
d0ce4b9d81 | ||
|
|
f08af96294 | ||
|
|
315ab663df | ||
|
|
fbd46f9b1c | ||
|
|
74c099fe63 | ||
|
|
2acfab62f0 | ||
|
|
0f9a6266e2 | ||
|
|
ca447d9a23 | ||
|
|
444dbe1cec | ||
|
|
20ce55eb3a | ||
|
|
3956aba429 | ||
|
|
6a37f5e4d6 | ||
|
|
f71bfd5e28 | ||
|
|
38cc14a1af | ||
|
|
bde9a63390 | ||
|
|
8eb816c314 | ||
|
|
50c05c4eed | ||
|
|
4eb5cfab7b | ||
|
|
df6fe7a379 | ||
|
|
78eec961a2 | ||
|
|
adff33c889 | ||
|
|
372fcd722c | ||
|
|
0982863e2d | ||
|
|
9b58a951f0 | ||
|
|
ba04f3fd5d | ||
|
|
ff52367c1c | ||
|
|
a0a017d54d | ||
|
|
6cad2c6f28 | ||
|
|
cec98ee9e2 | ||
|
|
dbef400762 | ||
|
|
1bd85de19a | ||
|
|
0b206129ac | ||
|
|
5e491801da | ||
|
|
eed09600f7 | ||
|
|
8d6634ff7e | ||
|
|
6c9ed3ca53 | ||
|
|
ede1befffa | ||
|
|
2cd4852321 | ||
|
|
1eb719f2d9 | ||
|
|
bf633082ac | ||
|
|
075a152779 | ||
|
|
c079a13b24 | ||
|
|
113c9d5a02 | ||
|
|
05fa677382 | ||
|
|
ab3c070e1c | ||
|
|
2e6a01b931 | ||
|
|
9fa66bf237 | ||
|
|
98c382e7af | ||
|
|
94c7a3862a | ||
|
|
6869b64b31 | ||
|
|
8faf6f7b72 | ||
|
|
99ddb2f12a | ||
|
|
ca9212c3ca | ||
|
|
c9183f3851 | ||
|
|
0912a7f473 | ||
|
|
38421657b3 | ||
|
|
64cfe1d389 | ||
|
|
69b0b58d46 | ||
|
|
0d442058e5 | ||
|
|
1ef31461bc | ||
|
|
0b09df97ac | ||
|
|
0263e39584 | ||
|
|
d8424726bb | ||
|
|
080cb2dd4b | ||
|
|
786caaecb2 | ||
|
|
eb92b5f1b3 | ||
|
|
c5ba6016aa | ||
|
|
73a845a327 | ||
|
|
6eec552ea4 | ||
|
|
cb62203cf3 | ||
|
|
4fcb64fe90 | ||
|
|
8966f47c7a | ||
|
|
e251375c0c | ||
|
|
672e1ec8c6 | ||
|
|
f8713ede2d | ||
|
|
0b5f854bf0 | ||
|
|
3770020b74 | ||
|
|
9f9a1638f7 | ||
|
|
fb07a937e7 | ||
|
|
025cd283c4 | ||
|
|
b39426dbf7 | ||
|
|
5157bd0960 | ||
|
|
2aaedef4af | ||
|
|
a0b037d288 | ||
|
|
011bdc22b2 | ||
|
|
b437d56736 | ||
|
|
6205e69ab2 | ||
|
|
038f8823f1 | ||
|
|
03dd8367bf | ||
|
|
b597da34da | ||
|
|
bf387f9544 | ||
|
|
365b5e8f8a | ||
|
|
47651766fb | ||
|
|
043ea54a2a | ||
|
|
55c8c82c4b | ||
|
|
557d1f4c49 | ||
|
|
2539a473fe | ||
|
|
6bd35a4c18 | ||
|
|
fb8f0ed4d6 | ||
|
|
3ffdf5459a | ||
|
|
02098b1903 | ||
|
|
c189553c8b | ||
|
|
d970705596 | ||
|
|
5c9ab40601 | ||
|
|
451d077170 | ||
|
|
30d1573346 | ||
|
|
0adef2db5b | ||
|
|
8c1866a4af | ||
|
|
2a7a594b49 | ||
|
|
78ea04556f | ||
|
|
7fe2944477 | ||
|
|
93131417e6 | ||
|
|
6ef5eb0665 | ||
|
|
24103ff5df | ||
|
|
2118de37c3 |
No files matched your search
@@ -1,147 +1,161 @@
|
|||||||
# This file is part of Mongoose project, http://code.google.com/p/mongoose
|
# This Makefile is part of Mongoose web server project,
|
||||||
# $Id: Makefile 473 2009-09-02 11:20:06Z valenok $
|
# https://github.com/valenok/mongoose
|
||||||
|
#
|
||||||
PROG= mongoose
|
# Example custom build:
|
||||||
|
# COPT="-g -O0 -DNO_SSL_DL -DUSE_LUA -llua -lcrypto -lssl" make linux
|
||||||
all:
|
#
|
||||||
@echo "make (linux|bsd|solaris|mac|windows|mingw)"
|
# Flags are:
|
||||||
|
|
||||||
# Possible COPT values: (in brackets are rough numbers for 'gcc -O2' on i386)
|
|
||||||
# -DHAVE_MD5 - use system md5 library (-2kb)
|
# -DHAVE_MD5 - use system md5 library (-2kb)
|
||||||
# -DNDEBUG - strip off all debug code (-5kb)
|
# -DNDEBUG - strip off all debug code (-5kb)
|
||||||
# -DDEBUG - build debug version (very noisy) (+7kb)
|
# -DDEBUG - build debug version (very noisy) (+7kb)
|
||||||
# -DNO_CGI - disable CGI support (-5kb)
|
# -DNO_CGI - disable CGI support (-5kb)
|
||||||
# -DNO_SSL - disable SSL functionality (-2kb)
|
# -DNO_SSL - disable SSL functionality (-2kb)
|
||||||
|
# -DNO_SSL_DL - link against system libssl library (-1kb)
|
||||||
# -DCONFIG_FILE=\"file\" - use `file' as the default config file
|
# -DCONFIG_FILE=\"file\" - use `file' as the default config file
|
||||||
# -DHAVE_STRTOUI64 - use system strtoui64() function for strtoull()
|
|
||||||
# -DSSL_LIB=\"libssl.so.<version>\" - use system versioned SSL shared object
|
# -DSSL_LIB=\"libssl.so.<version>\" - use system versioned SSL shared object
|
||||||
# -DCRYPTO_LIB=\"libcrypto.so.<version>\" - use system versioned CRYPTO so
|
# -DCRYPTO_LIB=\"libcrypto.so.<version>\" - use system versioned CRYPTO so
|
||||||
|
# -DUSE_LUA - embed Lua in Mongoose (+100kb)
|
||||||
|
|
||||||
|
PROG = mongoose
|
||||||
|
CFLAGS = -std=c99 -O2 -W -Wall -pedantic -pthread $(COPT)
|
||||||
|
|
||||||
##########################################################################
|
# To build with Lua, download and unzip Lua 5.2.1 source code into the
|
||||||
### UNIX build: linux, bsd, mac, rtems
|
# mongoose directory, and then add $(LUA_SOURCES) to CFLAGS
|
||||||
##########################################################################
|
LUA = lua-5.2.1/src
|
||||||
|
LUA_SOURCES = $(LUA)/lapi.c $(LUA)/lcode.c $(LUA)/lctype.c \
|
||||||
|
$(LUA)/ldebug.c $(LUA)/ldo.c $(LUA)/ldump.c \
|
||||||
|
$(LUA)/lfunc.c $(LUA)/lgc.c $(LUA)/llex.c \
|
||||||
|
$(LUA)/lmem.c $(LUA)/lobject.c $(LUA)/lopcodes.c \
|
||||||
|
$(LUA)/lparser.c $(LUA)/lstate.c $(LUA)/lstring.c \
|
||||||
|
$(LUA)/ltable.c $(LUA)/ltm.c $(LUA)/lundump.c \
|
||||||
|
$(LUA)/lvm.c $(LUA)/lzio.c $(LUA)/lauxlib.c \
|
||||||
|
$(LUA)/lbaselib.c $(LUA)/lbitlib.c $(LUA)/lcorolib.c \
|
||||||
|
$(LUA)/ldblib.c $(LUA)/liolib.c $(LUA)/lmathlib.c \
|
||||||
|
$(LUA)/loslib.c $(LUA)/lstrlib.c $(LUA)/ltablib.c \
|
||||||
|
$(LUA)/loadlib.c $(LUA)/linit.c
|
||||||
|
LUA_OBJECTS = $(LUA_SOURCES:%.c=%.o)
|
||||||
|
|
||||||
GCC_WARNS = -W -Wall -pedantic
|
# Using Visual Studio 6.0. To build Mongoose:
|
||||||
# -Wno-missing-field-initializers -Wno-unused-parameter -Wno-format-zero-length -Wno-missing-braces
|
# Set MSVC variable below to where VS 6.0 is installed on your system
|
||||||
CFLAGS = -std=c99 -O2 $(GCC_WARNS) $(COPT)
|
# Run "PATH_TO_VC6\bin\nmake windows"
|
||||||
MAC_SHARED = -flat_namespace -bundle -undefined suppress
|
MSVC = ../vc6
|
||||||
LINFLAGS = -ldl -pthread $(CFLAGS)
|
#DBG = /Zi /Od
|
||||||
LIB = lib$(PROG).so$(MONGOOSE_LIB_SUFFIX)
|
DBG = /DNDEBUG /O1
|
||||||
|
CL = $(MSVC)/bin/cl /MD /TC /nologo $(DBG) /Gz /W3 \
|
||||||
|
/I$(MSVC)/include /I$(LUA) /I. /I$(YASSL) /I$(YASSL)/cyassl /GA
|
||||||
|
MSLIB = /link /incremental:no /libpath:$(MSVC)/lib /machine:IX86 \
|
||||||
|
user32.lib shell32.lib comdlg32.lib ws2_32.lib advapi32.lib
|
||||||
|
|
||||||
|
# Stock windows binary builds with Lua and YASSL library.
|
||||||
|
YASSL = ../cyassl-2.4.6
|
||||||
|
YASSL_FLAGS = -I $(YASSL) -I $(YASSL)/cyassl \
|
||||||
|
-D _LIB -D OPENSSL_EXTRA -D HAVE_ERRNO_H \
|
||||||
|
-D HAVE_GETHOSTBYNAME -D HAVE_INET_NTOA -D HAVE_LIMITS_H \
|
||||||
|
-D HAVE_MEMSET -D HAVE_SOCKET -D HAVE_STDDEF_H -D HAVE_STDLIB_H \
|
||||||
|
-D HAVE_STRING_H -D HAVE_SYS_STAT_H -D HAVE_SYS_TYPES_H
|
||||||
|
YASSL_SOURCES = \
|
||||||
|
$(YASSL)/src/internal.c $(YASSL)/src/io.c $(YASSL)/src/keys.c \
|
||||||
|
$(YASSL)/src/ssl.c $(YASSL)/src/tls.c $(YASSL)/ctaocrypt/src/hmac.c \
|
||||||
|
$(YASSL)/ctaocrypt/src/random.c $(YASSL)/ctaocrypt/src/sha.c \
|
||||||
|
$(YASSL)/ctaocrypt/src/sha256.c $(YASSL)/ctaocrypt/src/logging.c \
|
||||||
|
$(YASSL)/ctaocrypt/src/error.c $(YASSL)/ctaocrypt/src/rsa.c \
|
||||||
|
$(YASSL)/ctaocrypt/src/des3.c $(YASSL)/ctaocrypt/src/asn.c \
|
||||||
|
$(YASSL)/ctaocrypt/src/coding.c $(YASSL)/ctaocrypt/src/arc4.c \
|
||||||
|
$(YASSL)/ctaocrypt/src/md4.c $(YASSL)/ctaocrypt/src/md5.c \
|
||||||
|
$(YASSL)/ctaocrypt/src/dh.c $(YASSL)/ctaocrypt/src/dsa.c \
|
||||||
|
$(YASSL)/ctaocrypt/src/pwdbased.c $(YASSL)/ctaocrypt/src/aes.c \
|
||||||
|
$(YASSL)/ctaocrypt/src/md2.c $(YASSL)/ctaocrypt/src/ripemd.c \
|
||||||
|
$(YASSL)/ctaocrypt/src/sha512.c $(YASSL)/src/sniffer.c \
|
||||||
|
$(YASSL)/ctaocrypt/src/rabbit.c $(YASSL)/ctaocrypt/src/misc.c \
|
||||||
|
$(YASSL)/ctaocrypt/src/tfm.c $(YASSL)/ctaocrypt/src/integer.c \
|
||||||
|
$(YASSL)/ctaocrypt/src/ecc.c $(YASSL)/src/ocsp.c $(YASSL)/src/crl.c \
|
||||||
|
$(YASSL)/ctaocrypt/src/hc128.c $(YASSL)/ctaocrypt/src/memory.c
|
||||||
|
|
||||||
|
all:
|
||||||
|
@echo "make (linux|bsd|solaris|mac|windows|mingw|cygwin)"
|
||||||
|
|
||||||
# Make sure that the compiler flags come last in the compilation string.
|
# 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
|
# If not so, this can break some on some Linux distros which use
|
||||||
# "-Wl,--as-needed" turned on by default in cc command.
|
# "-Wl,--as-needed" turned on by default in cc command.
|
||||||
# Also, this is turned in many other distros in static linkage builds.
|
# Also, this is turned in many other distros in static linkage builds.
|
||||||
linux:
|
linux:
|
||||||
$(CC) mongoose.c -shared -fPIC -fpic -o $(LIB) -Wl,-soname,$(LIB) $(LINFLAGS)
|
$(CC) mongoose.c main.c -o $(PROG) -ldl $(CFLAGS)
|
||||||
$(CC) mongoose.c main.c -o $(PROG) $(LINFLAGS)
|
|
||||||
|
|
||||||
|
mac: bsd
|
||||||
bsd:
|
bsd:
|
||||||
$(CC) mongoose.c -shared -pthread -fpic -fPIC -o $(LIB) $(CFLAGS)
|
$(CC) mongoose.c main.c -o $(PROG) $(CFLAGS)
|
||||||
$(CC) mongoose.c main.c -pthread -o $(PROG) $(CFLAGS)
|
|
||||||
|
|
||||||
mac:
|
bsd_yassl:
|
||||||
$(CC) mongoose.c -pthread -o $(LIB) $(MAC_SHARED) $(CFLAGS)
|
$(CC) mongoose.c main.c build/lsqlite3.c build/sqlite3.c -o $(PROG) \
|
||||||
$(CC) mongoose.c main.c -pthread -o $(PROG) $(CFLAGS)
|
$(CFLAGS) -I$(LUA) -Ibuild \
|
||||||
|
$(YASSL_SOURCES) $(YASSL_FLAGS) -DNO_SSL_DL \
|
||||||
|
$(LUA_SOURCES) -DUSE_LUA -DUSE_LUA_SQLITE3 -DLUA_COMPAT_ALL
|
||||||
|
|
||||||
solaris:
|
solaris:
|
||||||
$(CC) mongoose.c -pthread -lnsl \
|
$(CC) mongoose.c main.c -lnsl -lsocket -o $(PROG) $(CFLAGS)
|
||||||
-lsocket -fpic -fPIC -shared -o $(LIB) $(CFLAGS)
|
|
||||||
$(CC) mongoose.c main.c -pthread -lnsl -lsocket -o $(PROG) $(CFLAGS)
|
|
||||||
|
|
||||||
|
# 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
|
||||||
|
cocoa:
|
||||||
|
$(CC) mongoose.c main.c build/lsqlite3.c build/sqlite3.c \
|
||||||
|
-DUSE_COCOA $(CFLAGS) -I$(LUA) -Ibuild \
|
||||||
|
$(YASSL_SOURCES) $(YASSL_FLAGS) -DNO_SSL_DL \
|
||||||
|
$(LUA_SOURCES) -DUSE_LUA -DUSE_LUA_SQLITE3 -DLUA_COMPAT_ALL \
|
||||||
|
-framework Cocoa -ObjC -arch i386 -arch x86_64 -o Mongoose
|
||||||
|
V=`perl -lne '/define\s+MONGOOSE_VERSION\s+"(\S+)"/ and print $$1' mongoose.c`; DIR=dmg/Mongoose.app && rm -rf $$DIR && mkdir -p $$DIR/Contents/{MacOS,Resources} && install -m 644 build/mongoose_*.png $$DIR/Contents/Resources/ && install -m 644 build/Info.plist $$DIR/Contents/ && install -m 755 Mongoose $$DIR/Contents/MacOS/ && ln -fs /Applications dmg/ ; hdiutil create Mongoose_$$V.dmg -volname "Mongoose $$V" -srcfolder dmg -ov #; rm -rf dmg
|
||||||
|
|
||||||
##########################################################################
|
u:
|
||||||
### WINDOWS build: Using Visual Studio or Mingw
|
$(CC) test/unit_test.c -o unit_test -I. -I$(LUA) $(LUA_SOURCES) \
|
||||||
##########################################################################
|
$(CFLAGS) -g -O0
|
||||||
|
./unit_test
|
||||||
|
|
||||||
# Using Visual Studio 6.0. To build Mongoose:
|
w:
|
||||||
# o Set MSVC variable below to where VS 6.0 is installed on your system
|
$(CL) test/unit_test.c $(LUA_SOURCES) \
|
||||||
# o Run "PATH_TO_VC6\bin\nmake windows"
|
$(YASSL_SOURCES) $(YASSL_FLAGS) /DNO_SSL_DL \
|
||||||
|
$(MSLIB) /out:unit_test.exe
|
||||||
|
./unit_test.exe
|
||||||
|
|
||||||
MSVC = e:/vc6
|
windows:
|
||||||
CYA = e:/cyassl-2.0.0rc2
|
$(MSVC)/bin/rc build\res.rc
|
||||||
#DBG = /Zi /DDEBUG /Od
|
$(CL) main.c mongoose.c build/lsqlite3.c build/sqlite3.c \
|
||||||
DBG = /DNDEBUG /O1
|
$(YASSL_SOURCES) $(YASSL_FLAGS) /DNO_SSL_DL \
|
||||||
CL = $(MSVC)/bin/cl /MD /TC /nologo $(DBG) /Gz /W3 /DNO_SSL_DL \
|
$(LUA_SOURCES) /DUSE_LUA /DUSE_LUA_SQLITE3 /DLUA_COMPAT_ALL \
|
||||||
/I$(MSVC)/include
|
$(MSLIB) build\res.res /out:$(PROG).exe /subsystem:windows
|
||||||
GUILIB= user32.lib shell32.lib
|
|
||||||
LINK = /link /incremental:no /libpath:$(MSVC)/lib /machine:IX86 \
|
|
||||||
/subsystem:windows ws2_32.lib advapi32.lib cyassl.lib
|
|
||||||
CYAFL = /c /I $(CYA)/include -I $(CYA)/include/openssl /I$(MSVC)/INCLUDE \
|
|
||||||
/I $(CYA)/ctaocrypt/include /D _LIB /D OPENSSL_EXTRA
|
|
||||||
|
|
||||||
CYASRC= \
|
|
||||||
$(CYA)/src/cyassl_int.c \
|
|
||||||
$(CYA)/src/cyassl_io.c \
|
|
||||||
$(CYA)/src/keys.c \
|
|
||||||
$(CYA)/src/tls.c \
|
|
||||||
$(CYA)/src/ssl.c \
|
|
||||||
$(CYA)/ctaocrypt/src/aes.c \
|
|
||||||
$(CYA)/ctaocrypt/src/arc4.c \
|
|
||||||
$(CYA)/ctaocrypt/src/asn.c \
|
|
||||||
$(CYA)/ctaocrypt/src/coding.c \
|
|
||||||
$(CYA)/ctaocrypt/src/ctc_asm.c \
|
|
||||||
$(CYA)/ctaocrypt/src/ctc_misc.c \
|
|
||||||
$(CYA)/ctaocrypt/src/cyassl_memory.c \
|
|
||||||
$(CYA)/ctaocrypt/src/des3.c \
|
|
||||||
$(CYA)/ctaocrypt/src/dh.c \
|
|
||||||
$(CYA)/ctaocrypt/src/dsa.c \
|
|
||||||
$(CYA)/ctaocrypt/src/ecc.c \
|
|
||||||
$(CYA)/ctaocrypt/src/hc128.c \
|
|
||||||
$(CYA)/ctaocrypt/src/hmac.c \
|
|
||||||
$(CYA)/ctaocrypt/src/integer.c \
|
|
||||||
$(CYA)/ctaocrypt/src/md4.c \
|
|
||||||
$(CYA)/ctaocrypt/src/md5.c \
|
|
||||||
$(CYA)/ctaocrypt/src/pwdbased.c \
|
|
||||||
$(CYA)/ctaocrypt/src/rabbit.c \
|
|
||||||
$(CYA)/ctaocrypt/src/random.c \
|
|
||||||
$(CYA)/ctaocrypt/src/ripemd.c \
|
|
||||||
$(CYA)/ctaocrypt/src/rsa.c \
|
|
||||||
$(CYA)/ctaocrypt/src/sha.c \
|
|
||||||
$(CYA)/ctaocrypt/src/sha256.c \
|
|
||||||
$(CYA)/ctaocrypt/src/sha512.c \
|
|
||||||
$(CYA)/ctaocrypt/src/tfm.c
|
|
||||||
|
|
||||||
cyassl.lib:
|
|
||||||
$(CL) $(CYASRC) $(CYAFL) $(DEF)
|
|
||||||
$(MSVC)/bin/lib *.obj /out:$@
|
|
||||||
|
|
||||||
windows: cyassl.lib
|
|
||||||
$(MSVC)/bin/rc win32\res.rc
|
|
||||||
$(CL) /I win32 main.c mongoose.c /GA $(LINK) win32\res.res \
|
|
||||||
$(GUILIB) /out:$(PROG).exe
|
|
||||||
$(CL) mongoose.c /GD $(LINK) /DLL /DEF:win32\dll.def /out:$(PROG).dll
|
|
||||||
|
|
||||||
# Build for Windows under MinGW
|
# Build for Windows under MinGW
|
||||||
#MINGWDBG= -DDEBUG -O0 -ggdb
|
#MINGWDBG= -DDEBUG -O0 -ggdb
|
||||||
MINGWDBG= -DNDEBUG -Os
|
MINGWDBG= -DNDEBUG -Os
|
||||||
MINGWOPT= -W -Wall -mthreads -Wl,--subsystem,console $(MINGWDBG) -DHAVE_STDINT $(GCC_WARNINGS) $(COPT)
|
MINGWOPT= -W -Wall -mthreads -Wl,--subsystem,console $(MINGWDBG) -DHAVE_STDINT $(GCC_WARNINGS) $(COPT)
|
||||||
#MINGWOPT= -W -Wall -mthreads -Wl,--subsystem,windows $(MINGWDBG) -DHAVE_STDINT $(GCC_WARNINGS) $(COPT)
|
|
||||||
mingw:
|
mingw:
|
||||||
windres win32\res.rc win32\res.o
|
windres build\res.rc build\res.o
|
||||||
$(CC) $(MINGWOPT) mongoose.c -lws2_32 \
|
$(CC) $(MINGWOPT) mongoose.c -lws2_32 \
|
||||||
-shared -Wl,--out-implib=$(PROG).lib -o $(PROG).dll
|
-shared -Wl,--out-implib=$(PROG).lib -o $(PROG).dll
|
||||||
$(CC) $(MINGWOPT) -Iwin32 mongoose.c main.c win32\res.o -lws2_32 -ladvapi32 \
|
$(CC) $(MINGWOPT) mongoose.c main.c build\res.o \
|
||||||
-o $(PROG).exe
|
-lws2_32 -ladvapi32 -lcomdlg32 -o $(PROG).exe
|
||||||
|
|
||||||
|
# Build for Windows under Cygwin
|
||||||
|
#CYGWINDBG= -DDEBUG -O0 -ggdb
|
||||||
|
CYGWINDBG= -DNDEBUG -Os
|
||||||
|
CYGWINOPT= -W -Wall -mthreads -Wl,--subsystem,console $(CYGWINDBG) -DHAVE_STDINT $(GCC_WARNINGS) $(COPT)
|
||||||
|
cygwin:
|
||||||
|
windres ./build/res.rc ./build/res.o
|
||||||
|
$(CC) $(CYGWINOPT) mongoose.c -lws2_32 \
|
||||||
|
-shared -Wl,--out-implib=$(PROG).lib -o $(PROG).dll
|
||||||
|
$(CC) $(CYGWINOPT) -Ibuild mongoose.c main.c ./build/res.o \
|
||||||
|
-lws2_32 -ladvapi32 -o $(PROG).exe
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
### Manuals, cleanup, test, release
|
|
||||||
##########################################################################
|
|
||||||
|
|
||||||
man:
|
|
||||||
groff -man -T ascii mongoose.1 | col -b > mongoose.txt
|
|
||||||
groff -man -T ascii mongoose.1 | less
|
|
||||||
|
|
||||||
# "TEST=unit make test" - perform unit test only
|
|
||||||
# "TEST=embedded" - test embedded API by building and testing test/embed.c
|
|
||||||
# "TEST=basic_tests" - perform basic tests only (no CGI, SSI..)
|
|
||||||
tests:
|
tests:
|
||||||
perl test/test.pl $(TEST)
|
perl test/test.pl $(TEST)
|
||||||
|
|
||||||
release: clean
|
tarball: clean
|
||||||
F=mongoose-`perl -lne '/define\s+MONGOOSE_VERSION\s+"(\S+)"/ and print $$1' mongoose.c`.tgz ; cd .. && tar -czf x mongoose/{LICENSE,Makefile,bindings,examples,test,win32,mongoose.c,mongoose.h,mongoose.1,main.c} && mv x mongoose/$$F
|
F=mongoose-`perl -lne '/define\s+MONGOOSE_VERSION\s+"(\S+)"/ and print $$1' mongoose.c`.tgz ; cd .. && tar -czf x mongoose/{LICENSE,Makefile,examples,test,build,*.[ch],*.md} && mv x mongoose/$$F
|
||||||
|
|
||||||
|
release: tarball cocoa
|
||||||
|
wine make windows
|
||||||
|
V=`perl -lne '/define\s+MONGOOSE_VERSION\s+"(\S+)"/ and print $$1' mongoose.c`; upx mongoose.exe; cp mongoose.exe mongoose-$$V.exe; cp mongoose.exe mongoose_php_bundle/; zip -r mongoose_php_bundle_$$V.zip mongoose_php_bundle/
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf *.o *.core $(PROG) *.obj *.so $(PROG).txt *.dSYM *.tgz $(PROG).exe *.dll *.lib
|
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
|
||||||
@@ -1,31 +1,67 @@
|
|||||||
|
Project Mission
|
||||||
|
---------------
|
||||||
|
|
||||||
|
Project mission is to provide simple, functional, embeddable web server to
|
||||||
|
make it easy for application and device developers to implement web interface
|
||||||
|
for their application and devices, and to offer a simple web development
|
||||||
|
environment.
|
||||||
|
|
||||||
Overview
|
Overview
|
||||||
--------
|
--------
|
||||||
|
|
||||||
Mongoose is easy to use web server. It also can be used as embedded web server library to provide web interface to applications.
|
To accomplish it's mission, Mongoose keeps balance on functionality and
|
||||||
|
simplicity by carefully selected list of features:
|
||||||
|
|
||||||
Mongoose executable does not depend on any external library or configuration. If it is copied to any directory and launched from there, it starts to serve that directory on port 8080 (so to access files, go to http://localhost:8080). If some additional config is required - for example, different listening port or IP-based access control, then a mongoose.conf file with respective options can be created in the same directory where executable lives. This makes Mongoose perfect for all sorts of demos, quick tests, file sharing, and Web programming.
|
- Liberal, commercial-friendly
|
||||||
|
[MIT license](http://en.wikipedia.org/wiki/MIT_License)
|
||||||
|
- Works on Windows, Mac, UNIX, iPhone, Android, and many other platforms
|
||||||
|
- Support for CGI, SSL, SSI, Digest (MD5) authorization, Websocket, WEbDAV
|
||||||
|
- Lua server pages (PHP-like functionality using Lua), see
|
||||||
|
[page.lp](https://github.com/valenok/mongoose/blob/master/test/page.lp)
|
||||||
|
- Resumed download, URL rewrite, IP-based ACL, Windows service
|
||||||
|
- Excluding files from serving by URI pattern (file blacklist)
|
||||||
|
- Download speed limit based on client subnet or URI pattern
|
||||||
|
- Small footprint: executable size is 50 kB on Linux 2.6 i386 system
|
||||||
|
- 130 kilobytes Windows executable with all of the above and no dependencies
|
||||||
|
- Simple and clean embedding API,
|
||||||
|
[mongoose.h](https://github.com/valenok/mongoose/blob/master/mongoose.h).
|
||||||
|
The source is in single
|
||||||
|
[mongoose.c](https://github.com/valenok/mongoose/blob/master/mongoose.c) file
|
||||||
|
to make things easy
|
||||||
|
- Embedding examples:
|
||||||
|
[hello.c](https://github.com/valenok/mongoose/blob/master/examples/hello.c),
|
||||||
|
[post.c](https://github.com/valenok/mongoose/blob/master/examples/post.c),
|
||||||
|
[upload.c](https://github.com/valenok/mongoose/blob/master/examples/upload.c),
|
||||||
|
[websocket.c](https://github.com/valenok/mongoose/blob/master/examples/websocket.c)
|
||||||
|
- HTTP client functionality for embedded usage, capable of
|
||||||
|
sending arbitrary HTTP/HTTPS requests
|
||||||
|
- Extensive documentation in form of
|
||||||
|
[User Manual](https://github.com/valenok/mongoose/blob/master/UserManual.md)
|
||||||
|
|
||||||
|
Questions can be asked at
|
||||||
Features
|
[mongoose-users@google.com](http://groups.google.com/group/mongoose-users)
|
||||||
--------
|
mailing list.
|
||||||
|
|
||||||
- Crossplatform - works on Windows, MacOS and most flavors of UNIX
|
|
||||||
- CGI, SSL, SSI, Digest (MD5) authorization, Websocket, WEbDAV support
|
|
||||||
- Resumed download, URL rewrite support
|
|
||||||
- IP-based ACL, Windows service, GET, POST, HEAD, PUT, DELETE methods
|
|
||||||
- Small footprint: executable size is 40 kB on Linux 2.6 i386 system
|
|
||||||
- Embeddable with simple and clean API ([mongoose.h](https://github.com/valenok/mongoose/blob/master/mongoose.h)). The source is in single [mongoose.c](https://github.com/valenok/mongoose/blob/master/mongoose.c) file to make things easy.
|
|
||||||
- Embedding examples: [hello.c](https://github.com/valenok/mongoose/blob/master/examples/hello.c), [post.c](https://github.com/valenok/mongoose/blob/master/examples/post.c), [upload.c](https://github.com/valenok/mongoose/blob/master/examples/upload.c), [websocket.c](https://github.com/valenok/mongoose/blob/master/examples/websocket.c)
|
|
||||||
- Python and C# bindings
|
|
||||||
|
|
||||||
|
|
||||||
Mailing list
|
|
||||||
------------
|
|
||||||
|
|
||||||
You can read it online, subscribe to, or send a message at [mongoose-users](http://groups.google.com/group/mongoose-users).
|
|
||||||
|
|
||||||
|
|
||||||
Keep Sergey happy
|
Keep Sergey happy
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
I have a [books wishlist](http://amzn.com/w/1OC2ZCPTQYIEP?sort=priority) on Amazon. If you feel brave, you can buy me a book!
|
I am Sergey Lyubka, a software engineer from Galway, Ireland. I started
|
||||||
|
working on Mongoose in 2004, and since then continuously improving it,
|
||||||
|
investing thousands of hours of work. My other project I'm contributing to the
|
||||||
|
community for free is
|
||||||
|
[Super Light Regular Expression library](http://code.google.com/p/slre).
|
||||||
|
|
||||||
|
|
||||||
|
If you feel grateful for the stuff I've done, you can buy me a book from my
|
||||||
|
[Amazon wishlist](http://amzn.com/w/1OC2ZCPTQYIEP?sort=priority). Many thanks
|
||||||
|
to all who already did so: T.Barmann, D.Hughes, J.C.Sloan, R.Romeo,
|
||||||
|
L.E.Spencer, S.Kotay, B.Fjukstad and 6 others.
|
||||||
|
Appreciated guys, you keep my brains going!
|
||||||
|
|
||||||
|
Cash is also appreciated indeed. Press
|
||||||
|
[<img src="http://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif">](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DGZ2FMP95TAL6)
|
||||||
|
button to donate. Donation progress: 4/1000 €
|
||||||
|
(thanks to O.M.Vilhunen, C.Radik)
|
||||||
|
|
||||||
|

|
||||||
+215
@@ -0,0 +1,215 @@
|
|||||||
|
|
||||||
|
**NOTE: THIS MANUAL IS WORK IN PROGRESS**
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
Mongoose is small and easy to use web server. It is self-contained, and does
|
||||||
|
not require any external software to run.
|
||||||
|
|
||||||
|
On Windows, mongoose iconifies itself to the system tray icon when started.
|
||||||
|
Right-click on the icon pops up a menu, where it is possible to stop
|
||||||
|
mongoose, or configure it, or install it as Windows service.
|
||||||
|
|
||||||
|
On UNIX and Mac, mongoose is a command line utility. Running `mongoose` in
|
||||||
|
terminal, optionally followed by configuration parameters
|
||||||
|
(`mongoose [OPTIONS]`) or configuration file name
|
||||||
|
(`mongoose [config_file_name]`) starts the
|
||||||
|
web server. Mongoose does not detach from terminal. Pressing `Ctrl-C` keys
|
||||||
|
would stop the server.
|
||||||
|
|
||||||
|
When started, mongoose first searches for the configuration file.
|
||||||
|
If configuration file is specified explicitly in the command line, i.e.
|
||||||
|
`mongoose path_to_config_file`, then specified configuration file is used.
|
||||||
|
Otherwise, mongoose would search for file `mongoose.conf` in the same directory
|
||||||
|
where binary is located, and use it.
|
||||||
|
Configuration file is a sequence of lines, each line containing
|
||||||
|
command line argument name and it's value. Empty lines, and lines beginning
|
||||||
|
with `#`, are ignored. Here is the example of `mongoose.conf` file:
|
||||||
|
|
||||||
|
# mongoose.conf file
|
||||||
|
document_root c:\www
|
||||||
|
listening_ports 8080,8043s
|
||||||
|
ssl_certificate c:\mongoose\ssl_cert.pem
|
||||||
|
|
||||||
|
When configuration file is processed, mongoose process command line arguments,
|
||||||
|
if they are specified. Command line arguments therefore can override
|
||||||
|
configuration file settings. Command line arguments must start with `-`.
|
||||||
|
For example, if `mongoose.conf` has line
|
||||||
|
`document_root /var/www`, and mongoose has been started as
|
||||||
|
`mongoose -document_root /etc`, then `/etc` directory will be served as
|
||||||
|
document root, because command line options take priority over
|
||||||
|
configuration file.
|
||||||
|
|
||||||
|
Mongoose can also be used to modify `.htpasswd` passwords file:
|
||||||
|
|
||||||
|
mongoose -A <htpasswd_file> <realm> <user> <passwd>
|
||||||
|
|
||||||
|
## Usage Examples
|
||||||
|
|
||||||
|
- How to share a Windows folder: copy mongoose executable to a folder and
|
||||||
|
double-click the executable. The folder should be accessible via
|
||||||
|
[http://localhost:8080](http://localhost:8080) in any browser.
|
||||||
|
|
||||||
|
- How to start mongoose at UNIX startup time in daemon mode, serving
|
||||||
|
directory `/var/www`: put this line in the system startup script:
|
||||||
|
`/path/to/mongoose -listening_ports 80 -document_root /var/www &`
|
||||||
|
|
||||||
|
- How to serve user home directories using URL rewrite:
|
||||||
|
`mongoose -url_rewrite_patterns /~joe/=/home/joe/,/~bill=/home/bill/`
|
||||||
|
|
||||||
|
## Configuration Options
|
||||||
|
```
|
||||||
|
-C cgi_pattern
|
||||||
|
All files that fully match cgi_pattern are treated as CGI.
|
||||||
|
Default pattern allows CGI files be anywhere. To restrict CGIs to
|
||||||
|
certain directory, use e.g. "-C /cgi-bin/**.cgi". Default:
|
||||||
|
"**.cgi$|**.pl$|**.php$"
|
||||||
|
|
||||||
|
-E cgi_environment
|
||||||
|
Extra environment variables to be passed to the CGI script in
|
||||||
|
addition to standard ones. The list must be comma-separated list
|
||||||
|
of X=Y pairs, like this: "VARIABLE1=VALUE1,VARIABLE2=VALUE2".
|
||||||
|
Default: ""
|
||||||
|
|
||||||
|
-G put_delete_passwords_file
|
||||||
|
PUT and DELETE passwords file. This must be specified if PUT or
|
||||||
|
DELETE methods are used. Default: ""
|
||||||
|
|
||||||
|
-I cgi_interpreter
|
||||||
|
Use cgi_interpreter as a CGI interpreter for all CGI scripts
|
||||||
|
regardless script extension. Mongoose decides which interpreter
|
||||||
|
to use by looking at the first line of a CGI script. Default:
|
||||||
|
"".
|
||||||
|
|
||||||
|
-P protect_uri
|
||||||
|
Comma separated list of URI=PATH pairs, specifying that given
|
||||||
|
URIs must be protected with respected password files. Default: ""
|
||||||
|
|
||||||
|
-R authentication_domain
|
||||||
|
Authorization realm. Default: "mydomain.com"
|
||||||
|
|
||||||
|
-S ssi_pattern
|
||||||
|
All files that fully match ssi_pattern are treated as SSI.
|
||||||
|
Unknown SSI directives are silently ignored. Currently, two SSI
|
||||||
|
directives are supported, "include" and "exec". Default:
|
||||||
|
"**.shtml$|**.shtm$"
|
||||||
|
|
||||||
|
-T throttle
|
||||||
|
Limit download speed for clients. throttle is a comma-separated
|
||||||
|
list of key=value pairs, where key could be a '*' character
|
||||||
|
(limit for all connections), a subnet in form x.x.x.x/mask (limit
|
||||||
|
for a given subnet, for example 10.0.0.0/8), or an URI prefix
|
||||||
|
pattern (limit for the set of URIs, for example /foo/**). The
|
||||||
|
value is a floating-point number of bytes per second, optionally
|
||||||
|
followed by a `k' or `m' character, meaning kilobytes and
|
||||||
|
megabytes respectively. A limit of 0 means unlimited rate. The
|
||||||
|
last matching rule wins. For example, "*=1k,10.0.0.0/8" means
|
||||||
|
limit everybody to 1 kilobyte per second, but give people from
|
||||||
|
10/8 subnet unlimited speed. Default: ""
|
||||||
|
|
||||||
|
-a access_log_file
|
||||||
|
Access log file. Default: "", no logging is done.
|
||||||
|
|
||||||
|
-d enable_directory_listing
|
||||||
|
Enable/disable directory listing. Default: "yes"
|
||||||
|
|
||||||
|
-e error_log_file
|
||||||
|
Error log file. Default: "", no errors are logged.
|
||||||
|
|
||||||
|
-g global_passwords_file
|
||||||
|
Location of a global passwords file. If set, per-directory
|
||||||
|
.htpasswd files are ignored, and all requests must be authorised
|
||||||
|
against that file. Default: ""
|
||||||
|
|
||||||
|
-i index_files
|
||||||
|
Comma-separated list of files to be treated as directory index
|
||||||
|
files. Default: "index.html,index.htm,index.cgi"
|
||||||
|
|
||||||
|
-l access_control_list
|
||||||
|
Specify access control list (ACL). ACL is a comma separated list
|
||||||
|
of IP subnets, each subnet is prepended by '-' or '+' sign. Plus
|
||||||
|
means allow, minus means deny. If subnet mask is omitted, like
|
||||||
|
"-1.2.3.4", then it means single IP address. Mask may vary from 0
|
||||||
|
to 32 inclusive. On each request, full list is traversed, and
|
||||||
|
last match wins. Default setting is to allow all. For example, to
|
||||||
|
allow only 192.168/16 subnet to connect, run "mongoose
|
||||||
|
-0.0.0.0/0,+192.168/16". Default: ""
|
||||||
|
|
||||||
|
-m extra_mime_types
|
||||||
|
Extra mime types to recognize, in form "extension1=type1,exten-
|
||||||
|
sion2=type2,...". Extension must include dot. Example: "mongoose
|
||||||
|
-m .cpp=plain/text,.java=plain/text". Default: ""
|
||||||
|
|
||||||
|
-p listening_ports
|
||||||
|
Comma-separated list of ports to listen on. If the port is SSL, a
|
||||||
|
letter 's' must be appeneded, for example, "-p 80,443s" will open
|
||||||
|
port 80 and port 443, and connections on port 443 will be SSL-ed.
|
||||||
|
It is possible to specify an IP address to bind to. In this case,
|
||||||
|
an IP address and a colon must be prepended to the port number.
|
||||||
|
For example, to bind to a loopback interface on port 80 and to
|
||||||
|
all interfaces on HTTPS port 443, use "mongoose -p
|
||||||
|
127.0.0.1:80,443s". Default: "8080"
|
||||||
|
|
||||||
|
-r document_root
|
||||||
|
Location of the WWW root directory. Default: "."
|
||||||
|
|
||||||
|
-s ssl_certificate
|
||||||
|
Location of SSL certificate file. Default: ""
|
||||||
|
|
||||||
|
-t num_threads
|
||||||
|
Number of worker threads to start. Default: "10"
|
||||||
|
|
||||||
|
-u run_as_user
|
||||||
|
Switch to given user's credentials after startup. Default: ""
|
||||||
|
|
||||||
|
-w url_rewrite_patterns
|
||||||
|
Comma-separated list of URL rewrites in the form of "pattern=sub-
|
||||||
|
stitution,..." If the "pattern" matches some prefix of the
|
||||||
|
requested URL, then matched prefix gets substituted with "substi-
|
||||||
|
tution". For example, "-w /con-
|
||||||
|
fig=/etc,**.doc|**.rtf=/path/to/cgi-bin/handle_doc.cgi" will
|
||||||
|
serve all URLs that start with "/config" from the "/etc" direc-
|
||||||
|
tory, and call handle_doc.cgi script for .doc and .rtf file
|
||||||
|
requests. If some pattern matches, no further matching/substitu-
|
||||||
|
tion is performed (first matching pattern wins). Use full paths
|
||||||
|
in substitutions. Default: ""
|
||||||
|
|
||||||
|
-x hide_files_patterns
|
||||||
|
A prefix pattern for the files to hide. Files that match the pat-
|
||||||
|
tern will not show up in directory listing and return 404 Not
|
||||||
|
Found if requested. Default: ""
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Common Problems
|
||||||
|
---------------
|
||||||
|
- PHP doesn't work - getting empty page, or 'File not found' error. The
|
||||||
|
reason for that is wrong paths to the interpreter. Remember that with PHP,
|
||||||
|
correct interpreter is `php-cgi.exe` (`php-cgi` on UNIX). Solution: specify
|
||||||
|
full path to the PHP interpreter, e.g.
|
||||||
|
`mongoose -cgi_interpreter /full/path/to/php-cgi`
|
||||||
|
|
||||||
|
## Embedding
|
||||||
|
Embedding Mongoose is easy. Somewhere in the application code, `mg_start()`
|
||||||
|
function must be called. That starts the web server in a separate thread.
|
||||||
|
When it is not needed anymore, `mg_stop()` must be called. Application code
|
||||||
|
can pass configuration options to `mg_start()`, and also specify callback
|
||||||
|
functions that Mongoose should call at certain events.
|
||||||
|
[hello.c](http://a.c) provides a minimalistic example.
|
||||||
|
|
||||||
|
Common pattern is to implement `begin_request` callback, and serve static files
|
||||||
|
from memory, and/or construct dynamic replies on the fly. Here is
|
||||||
|
my [embed.c](https://gist.github.com/valenok/4714740) gist
|
||||||
|
that shows how to easily any data can be embedded
|
||||||
|
directly into the executable. If such data needs to be encrypted, then
|
||||||
|
encrypted database or encryption dongles would be a better choice.
|
||||||
|
|
||||||
|
|
||||||
|
## Other Resources
|
||||||
|
- Presentation made by Arnout Vandecappelle at FOSDEM 2011 on 2011-02-06
|
||||||
|
in Brussels, Belgium, called
|
||||||
|
"Creating secure web based user interfaces for Embedded Devices"
|
||||||
|
([pdf](http://mind.be/content/110206_Web-ui.pdf) |
|
||||||
|
[odp](http://mind.be/content/110206_Web-ui.odp))
|
||||||
|
- Linux Journal article by Michel J.Hammel, 2010-04-01, called
|
||||||
|
[Mongoose: an Embeddable Web Server in C](http://www.linuxjournal.com/article/10680)
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
// This is C# example on how to use Mongoose embeddable web server,
|
|
||||||
// http://code.google.com/p/mongoose
|
|
||||||
//
|
|
||||||
// Before using the mongoose module, make sure that Mongoose shared library is
|
|
||||||
// built and present in the current (or system library) directory
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
public class Program {
|
|
||||||
|
|
||||||
// This function is called when user types in his browser http://127.0.0.1:8080/foo
|
|
||||||
static private void UriHandler(MongooseConnection conn, MongooseRequestInfo ri) {
|
|
||||||
conn.write("HTTP/1.1 200 OK\r\n\r\n");
|
|
||||||
conn.write("Hello from C#!\n");
|
|
||||||
conn.write("Your user-agent is: " + conn.get_header("User-Agent") + "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static private void UriDumpInfo(MongooseConnection conn, MongooseRequestInfo ri)
|
|
||||||
{
|
|
||||||
conn.write("HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n");
|
|
||||||
conn.write("<html><body><head>Calling Info</head>");
|
|
||||||
conn.write("<p>Request: " + ri.request_method + "</p>");
|
|
||||||
conn.write("<p>URI: " + ri.uri + "</p>");
|
|
||||||
conn.write("<p>Query: " + ri.query_string + "</p>");
|
|
||||||
if (ri.post_data_len > 0) conn.write("<p>Post(" + ri.post_data_len + ")[@" + ri.post_data + "]: '" + Marshal.PtrToStringAnsi(ri.post_data) + "'</p>");
|
|
||||||
conn.write("<p>User:" + ri.remote_user + "</p>");
|
|
||||||
conn.write("<p>IP: " + ri.remote_ip + "</p>");
|
|
||||||
conn.write("<p>HTTP: " + ri.http_version + "</p>");
|
|
||||||
conn.write("<p>Port: " + ri.remote_port + "</p>");
|
|
||||||
conn.write("<p>NUM Headers: " + ri.num_headers + "</p>");
|
|
||||||
for (int i = 0; i < Math.Min(64, ri.num_headers); i++)
|
|
||||||
{
|
|
||||||
conn.write("<p>" + i + ":" + Marshal.PtrToStringAnsi(ri.http_headers[i].name)
|
|
||||||
+ ":" + Marshal.PtrToStringAnsi(ri.http_headers[i].value) + "</p>");
|
|
||||||
}
|
|
||||||
conn.write("</body></html>");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Main() {
|
|
||||||
Mongoose web_server = new Mongoose();
|
|
||||||
|
|
||||||
// Set options and /foo URI handler
|
|
||||||
web_server.set_option("ports", "8080");
|
|
||||||
web_server.set_option("root", "c:\\");
|
|
||||||
web_server.set_uri_callback("/foo", new MongooseCallback(UriHandler));
|
|
||||||
web_server.set_uri_callback("/dumpinfo", new MongooseCallback(UriDumpInfo));
|
|
||||||
|
|
||||||
// Serve requests until user presses "enter" on a keyboard
|
|
||||||
Console.ReadLine();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,134 +0,0 @@
|
|||||||
// Copyright (c) 2004-2009 Sergey Lyubka
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
// THE SOFTWARE.
|
|
||||||
//
|
|
||||||
// $Id: mongoose.cs 472 2009-08-30 22:40:29Z spsone1 $
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)] public struct MongooseHeader {
|
|
||||||
public IntPtr name; // Using IntPtr here because if we use strings here,
|
|
||||||
public IntPtr value; // it won't be properly marshalled.
|
|
||||||
};
|
|
||||||
|
|
||||||
// This is "struct mg_request_info" from mongoose.h header file
|
|
||||||
[StructLayout(LayoutKind.Sequential)] public struct MongooseRequestInfo {
|
|
||||||
public string request_method;
|
|
||||||
public string uri;
|
|
||||||
public string http_version;
|
|
||||||
public string query_string;
|
|
||||||
public IntPtr post_data;
|
|
||||||
public string remote_user;
|
|
||||||
public int remote_ip; //int to match the 32bit declaration in c
|
|
||||||
public int remote_port;
|
|
||||||
public int post_data_len;
|
|
||||||
public int status_code;
|
|
||||||
public int num_headers;
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray,SizeConst=64)] public MongooseHeader[] http_headers;
|
|
||||||
};
|
|
||||||
|
|
||||||
// This is a delegate for mg_callback_t from mongoose.h header file
|
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
||||||
public delegate void MongooseCallback2(IntPtr conn, ref MongooseRequestInfo ri, IntPtr user_data);
|
|
||||||
|
|
||||||
// This is a delegate to be used by the application
|
|
||||||
public delegate void MongooseCallback(MongooseConnection conn, MongooseRequestInfo ri);
|
|
||||||
|
|
||||||
public class Mongoose {
|
|
||||||
public string version;
|
|
||||||
private IntPtr ctx;
|
|
||||||
//These two events are here to store a ref to the callbacks while they are over in unmanaged code.
|
|
||||||
private event MongooseCallback2 delegates2;
|
|
||||||
private event MongooseCallback delegates1;
|
|
||||||
|
|
||||||
[DllImport("_mongoose",CallingConvention=CallingConvention.Cdecl)] private static extern IntPtr mg_start();
|
|
||||||
[DllImport("_mongoose",CallingConvention=CallingConvention.Cdecl)] private static extern void mg_stop(IntPtr ctx);
|
|
||||||
[DllImport("_mongoose",CallingConvention=CallingConvention.Cdecl)] private static extern string mg_version();
|
|
||||||
[DllImport("_mongoose",CallingConvention=CallingConvention.Cdecl)] private static extern int mg_set_option(IntPtr ctx, string name, string value);
|
|
||||||
[DllImport("_mongoose",CallingConvention=CallingConvention.Cdecl)] private static extern string mg_get_option(IntPtr ctx, string name);
|
|
||||||
[DllImport("_mongoose",CallingConvention=CallingConvention.Cdecl)] private static extern void mg_set_uri_callback(IntPtr ctx, string uri_regex, MulticastDelegate func, IntPtr data);
|
|
||||||
[DllImport("_mongoose",CallingConvention=CallingConvention.Cdecl)] private static extern void mg_set_log_callback(IntPtr ctx, MulticastDelegate func);
|
|
||||||
|
|
||||||
public Mongoose() {
|
|
||||||
ctx = mg_start();
|
|
||||||
version = mg_version();
|
|
||||||
}
|
|
||||||
|
|
||||||
~Mongoose() {
|
|
||||||
mg_stop(this.ctx);
|
|
||||||
this.ctx = IntPtr.Zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int set_option(string option_name, string option_value) {
|
|
||||||
return mg_set_option(this.ctx, option_name, option_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string get_option(string option_name) {
|
|
||||||
return mg_get_option(this.ctx, option_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void set_uri_callback(string uri_regex, MongooseCallback func) {
|
|
||||||
// Build a closure around user function. Initialize connection object there which wraps
|
|
||||||
// mg_write() and other useful methods, and then call user specified handler.
|
|
||||||
MongooseCallback2 callback = delegate(IntPtr conn, ref MongooseRequestInfo ri, IntPtr user_data) {
|
|
||||||
MongooseConnection connection = new MongooseConnection(conn, this);
|
|
||||||
func(connection, ri);
|
|
||||||
};
|
|
||||||
// store a reference to the callback so it won't be GC'ed while its over in unmanged code
|
|
||||||
delegates2 += callback;
|
|
||||||
mg_set_uri_callback(this.ctx, uri_regex, callback, IntPtr.Zero);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void set_log_callback(MongooseCallback func) {
|
|
||||||
delegates1 += func;
|
|
||||||
mg_set_log_callback(this.ctx, func);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MongooseConnection {
|
|
||||||
public Mongoose mongoose;
|
|
||||||
private IntPtr conn;
|
|
||||||
|
|
||||||
[DllImport("_mongoose",CallingConvention=CallingConvention.Cdecl)] private static extern string mg_get_header(IntPtr ctx, string name);
|
|
||||||
[DllImport("_mongoose",CallingConvention=CallingConvention.Cdecl)] private static extern string mg_get_var(IntPtr ctx, string name);
|
|
||||||
[DllImport("_mongoose",CallingConvention=CallingConvention.Cdecl)] private static extern void mg_free(IntPtr ptr);
|
|
||||||
[DllImport("_mongoose",CallingConvention=CallingConvention.Cdecl)] public static extern int mg_write(IntPtr conn, string data, int length);
|
|
||||||
|
|
||||||
public MongooseConnection(IntPtr conn_, Mongoose mongoose_) {
|
|
||||||
mongoose = mongoose_;
|
|
||||||
conn = conn_;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string get_header(string header_name) {
|
|
||||||
return mg_get_header(this.conn, header_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string get_var(string header_name) {
|
|
||||||
string s = mg_get_var(this.conn, header_name);
|
|
||||||
string copy = "" + s;
|
|
||||||
mg_free(Marshal.StringToHGlobalAnsi(s));
|
|
||||||
return copy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int write(string data) {
|
|
||||||
return mg_write(this.conn, data, data.Length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
# This is Python example on how to use Mongoose embeddable web server,
|
|
||||||
# http://code.google.com/p/mongoose
|
|
||||||
#
|
|
||||||
# Before using the mongoose module, make sure that Mongoose shared library is
|
|
||||||
# built and present in the current (or system library) directory
|
|
||||||
|
|
||||||
import mongoose
|
|
||||||
import sys
|
|
||||||
|
|
||||||
# Handle /show and /form URIs.
|
|
||||||
def EventHandler(event, conn):
|
|
||||||
info = conn.info
|
|
||||||
if event == mongoose.HTTP_ERROR:
|
|
||||||
conn.printf('%s', 'HTTP/1.0 200 OK\r\n')
|
|
||||||
conn.printf('%s', 'Content-Type: text/plain\r\n\r\n')
|
|
||||||
conn.printf('HTTP error: %d\n', conn.reply_status_code)
|
|
||||||
return True
|
|
||||||
elif event == mongoose.NEW_REQUEST and info.uri == '/show':
|
|
||||||
conn.printf('%s', 'HTTP/1.0 200 OK\r\n')
|
|
||||||
conn.printf('%s', 'Content-Type: text/plain\r\n\r\n')
|
|
||||||
conn.printf('%s %s\n', info.request_method, info.uri)
|
|
||||||
if info.request_method == 'POST':
|
|
||||||
content_len = conn.get_header('Content-Length')
|
|
||||||
post_data = conn.read(int(content_len))
|
|
||||||
my_var = conn.get_var(post_data, 'my_var')
|
|
||||||
else:
|
|
||||||
my_var = conn.get_var(info.query_string, 'my_var')
|
|
||||||
conn.printf('my_var: %s\n', my_var or '<not set>')
|
|
||||||
conn.printf('HEADERS: \n')
|
|
||||||
for header in info.http_headers[:info.num_headers]:
|
|
||||||
conn.printf(' %s: %s\n', header.name, header.value)
|
|
||||||
return True
|
|
||||||
elif event == mongoose.NEW_REQUEST and info.uri == '/form':
|
|
||||||
conn.write('HTTP/1.0 200 OK\r\n'
|
|
||||||
'Content-Type: text/html\r\n\r\n'
|
|
||||||
'Use GET: <a href="/show?my_var=hello">link</a>'
|
|
||||||
'<form action="/show" method="POST">'
|
|
||||||
'Use POST: type text and submit: '
|
|
||||||
'<input type="text" name="my_var"/>'
|
|
||||||
'<input type="submit"/>'
|
|
||||||
'</form>')
|
|
||||||
return True
|
|
||||||
elif event == mongoose.NEW_REQUEST and info.uri == '/secret':
|
|
||||||
conn.send_file('/etc/passwd')
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
# Create mongoose object, and register '/foo' URI handler
|
|
||||||
# List of options may be specified in the contructor
|
|
||||||
server = mongoose.Mongoose(EventHandler,
|
|
||||||
document_root='/tmp',
|
|
||||||
listening_ports='8080')
|
|
||||||
|
|
||||||
print ('Mongoose started on port %s, press enter to quit'
|
|
||||||
% server.get_option('listening_ports'))
|
|
||||||
|
|
||||||
sys.stdin.read(1)
|
|
||||||
|
|
||||||
# Deleting server object stops all serving threads
|
|
||||||
print 'Stopping server.'
|
|
||||||
del server
|
|
||||||
@@ -1,170 +0,0 @@
|
|||||||
# Copyright (c) 2004-2009 Sergey Lyubka
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
|
||||||
# all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
# THE SOFTWARE.
|
|
||||||
#
|
|
||||||
# $Id: mongoose.py 471 2009-08-30 14:30:21Z valenok $
|
|
||||||
|
|
||||||
"""
|
|
||||||
This module provides python binding for the Mongoose web server.
|
|
||||||
|
|
||||||
There are two classes defined:
|
|
||||||
|
|
||||||
Connection: - wraps all functions that accept struct mg_connection pointer
|
|
||||||
as first argument.
|
|
||||||
|
|
||||||
Mongoose: wraps all functions that accept struct mg_context pointer as
|
|
||||||
first argument.
|
|
||||||
|
|
||||||
Creating Mongoose object automatically starts server, deleting object
|
|
||||||
automatically stops it. There is no need to call mg_start() or mg_stop().
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
import ctypes
|
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
NEW_REQUEST = 0
|
|
||||||
REQUEST_COMPLETE = 1
|
|
||||||
HTTP_ERROR = 2
|
|
||||||
EVENT_LOG = 3
|
|
||||||
INIT_SSL = 4
|
|
||||||
WEBSOCKET_CONNECT = 5
|
|
||||||
WEBSOCKET_READY = 6
|
|
||||||
WEBSOCKET_MESSAGE = 7
|
|
||||||
WEBSOCKET_CLOSE = 8
|
|
||||||
|
|
||||||
|
|
||||||
class mg_header(ctypes.Structure):
|
|
||||||
"""A wrapper for struct mg_header."""
|
|
||||||
_fields_ = [
|
|
||||||
('name', ctypes.c_char_p),
|
|
||||||
('value', ctypes.c_char_p),
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class mg_request_info(ctypes.Structure):
|
|
||||||
"""A wrapper for struct mg_request_info."""
|
|
||||||
_fields_ = [
|
|
||||||
('request_method', ctypes.c_char_p),
|
|
||||||
('uri', ctypes.c_char_p),
|
|
||||||
('http_version', ctypes.c_char_p),
|
|
||||||
('query_string', ctypes.c_char_p),
|
|
||||||
('remote_user', ctypes.c_char_p),
|
|
||||||
('remote_ip', ctypes.c_long),
|
|
||||||
('remote_port', ctypes.c_int),
|
|
||||||
('is_ssl', ctypes.c_int),
|
|
||||||
('num_headers', ctypes.c_int),
|
|
||||||
('http_headers', mg_header * 64),
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
mg_callback_t = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_int, ctypes.c_void_p)
|
|
||||||
|
|
||||||
|
|
||||||
class Connection(object):
|
|
||||||
"""A wrapper class for all functions that take
|
|
||||||
struct mg_connection * as the first argument."""
|
|
||||||
|
|
||||||
def __init__(self, mongoose, connection):
|
|
||||||
self.m = mongoose
|
|
||||||
self.conn = ctypes.c_void_p(connection)
|
|
||||||
self.info = self.m.dll.mg_get_request_info(self.conn).contents
|
|
||||||
self.user_data = self.m.dll.mg_get_user_data(self.conn)
|
|
||||||
self.log_message = self.m.dll.mg_get_log_message(self.conn)
|
|
||||||
self.reply_status_code = self.m.dll.mg_get_reply_status_code(self.conn)
|
|
||||||
self.ssl_context = self.m.dll.mg_get_ssl_context(self.conn)
|
|
||||||
|
|
||||||
def get_header(self, name):
|
|
||||||
val = self.m.dll.mg_get_header(self.conn, name)
|
|
||||||
return ctypes.c_char_p(val).value
|
|
||||||
|
|
||||||
def get_var(self, data, name):
|
|
||||||
size = data and len(data) or 0
|
|
||||||
buf = ctypes.create_string_buffer(size)
|
|
||||||
n = self.m.dll.mg_get_var(data, size, name, buf, size)
|
|
||||||
return n >= 0 and buf or None
|
|
||||||
|
|
||||||
def printf(self, fmt, *args):
|
|
||||||
val = self.m.dll.mg_printf(self.conn, fmt, *args)
|
|
||||||
return ctypes.c_int(val).value
|
|
||||||
|
|
||||||
def write(self, data):
|
|
||||||
val = self.m.dll.mg_write(self.conn, data, len(data))
|
|
||||||
return ctypes.c_int(val).value
|
|
||||||
|
|
||||||
def read(self, size):
|
|
||||||
buf = ctypes.create_string_buffer(size)
|
|
||||||
n = self.m.dll.mg_read(self.conn, buf, size)
|
|
||||||
return n <= 0 and None or buf[:n]
|
|
||||||
|
|
||||||
def send_file(self, path):
|
|
||||||
self.m.dll.mg_send_file(self.conn, path)
|
|
||||||
|
|
||||||
|
|
||||||
class Mongoose(object):
|
|
||||||
"""A wrapper class for Mongoose shared library."""
|
|
||||||
|
|
||||||
def __init__(self, callback, **kwargs):
|
|
||||||
if os.name == 'nt':
|
|
||||||
self.dll = ctypes.WinDLL('mongoose.dll')
|
|
||||||
else:
|
|
||||||
self.dll = ctypes.CDLL('libmongoose.so')
|
|
||||||
|
|
||||||
self.dll.mg_start.restype = ctypes.c_void_p
|
|
||||||
self.dll.mg_modify_passwords_file.restype = ctypes.c_int
|
|
||||||
self.dll.mg_read.restype = ctypes.c_int
|
|
||||||
self.dll.mg_write.restype = ctypes.c_int
|
|
||||||
self.dll.mg_printf.restype = ctypes.c_int
|
|
||||||
self.dll.mg_get_header.restype = ctypes.c_char_p
|
|
||||||
self.dll.mg_get_var.restype = ctypes.c_int
|
|
||||||
self.dll.mg_get_cookie.restype = ctypes.c_int
|
|
||||||
self.dll.mg_get_option.restype = ctypes.c_char_p
|
|
||||||
self.dll.mg_get_request_info.restype = ctypes.POINTER(mg_request_info)
|
|
||||||
self.dll.mg_get_user_data.restype = ctypes.c_void_p
|
|
||||||
self.dll.mg_get_reply_status_code.restype = ctypes.c_int
|
|
||||||
self.dll.mg_get_log_message.restype = ctypes.c_char_p
|
|
||||||
self.dll.mg_get_ssl_context.restype = ctypes.c_void_p
|
|
||||||
|
|
||||||
if callback:
|
|
||||||
# Create a closure that will be called by the shared library.
|
|
||||||
def func(event, connection):
|
|
||||||
# Wrap connection pointer into the connection
|
|
||||||
# object and call Python callback
|
|
||||||
conn = Connection(self, connection)
|
|
||||||
return callback(event, conn) and 1 or 0
|
|
||||||
|
|
||||||
# Convert the closure into C callable object
|
|
||||||
self.callback = mg_callback_t(func)
|
|
||||||
self.callback.restype = ctypes.c_char_p
|
|
||||||
else:
|
|
||||||
self.callback = ctypes.c_void_p(0)
|
|
||||||
|
|
||||||
args = [y for x in kwargs.items() for y in x] + [None]
|
|
||||||
options = (ctypes.c_char_p * len(args))(*args)
|
|
||||||
|
|
||||||
ret = self.dll.mg_start(self.callback, 0, options)
|
|
||||||
self.ctx = ctypes.c_void_p(ret)
|
|
||||||
|
|
||||||
def __del__(self):
|
|
||||||
"""Destructor, stop Mongoose instance."""
|
|
||||||
self.dll.mg_stop(self.ctx)
|
|
||||||
|
|
||||||
def get_option(self, name):
|
|
||||||
return self.dll.mg_get_option(self.ctx, name)
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleExecutable</key> <string>Mongoose</string>
|
||||||
|
<key>CFBundlePackageType</key> <string>APPL</string>
|
||||||
|
<key>CFBundleTypeRole</key> <string>None</string>
|
||||||
|
<key>CFBundleIconFiles</key> <array>
|
||||||
|
<string>mongoose_16x16.png</string>
|
||||||
|
<string>mongoose_22x22.png</string>
|
||||||
|
<string>mongoose_32x32.png</string>
|
||||||
|
<string>mongoose_64x64.png</string>
|
||||||
|
</array>
|
||||||
|
<key>LSUIElement</key> <true/>
|
||||||
|
<key>RunAtLoad</key> <true/>
|
||||||
|
<key>Label</key> <string>com.kolkin.mongoose</string>
|
||||||
|
<key>ProgramArguments</key> <array> </array>
|
||||||
|
<key>KeepAlive</key> <true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
File renamed without changes.
+1885
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,589 @@
|
|||||||
|
%PDF-1.5␍%âãÏÓ
|
||||||
|
1 0 obj␍<</Metadata 2 0 R/OCProperties<</D<</ON[5 0 R]/Order 6 0 R/RBGroups[]>>/OCGs[5 0 R]>>/Pages 3 0 R/Type/Catalog>>␍endobj␍2 0 obj␍<</Length 16195/Subtype/XML/Type/Metadata>>stream
|
||||||
|
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
|
||||||
|
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.3-c011 66.145661, 2012/02/06-14:56:27 ">
|
||||||
|
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
||||||
|
<rdf:Description rdf:about=""
|
||||||
|
xmlns:xmp="http://ns.adobe.com/xap/1.0/"
|
||||||
|
xmlns:xmpGImg="http://ns.adobe.com/xap/1.0/g/img/">
|
||||||
|
<xmp:CreatorTool>Adobe Illustrator CS6 (Windows)</xmp:CreatorTool>
|
||||||
|
<xmp:CreateDate>2013-01-02T17:27:47+01:00</xmp:CreateDate>
|
||||||
|
<xmp:ModifyDate>2013-01-02T17:27:47Z</xmp:ModifyDate>
|
||||||
|
<xmp:MetadataDate>2013-01-02T17:27:47Z</xmp:MetadataDate>
|
||||||
|
<xmp:Thumbnails>
|
||||||
|
<rdf:Alt>
|
||||||
|
<rdf:li rdf:parseType="Resource">
|
||||||
|
<xmpGImg:width>256</xmpGImg:width>
|
||||||
|
<xmpGImg:height>228</xmpGImg:height>
|
||||||
|
<xmpGImg:format>JPEG</xmpGImg:format>
|
||||||
|
<xmpGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA
AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK
DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f
Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgA5AEAAwER
AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA
AQACAwQFBgcICQoLEAACA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alt>
|
||||||
|
</xmp:Thumbnails>
|
||||||
|
</rdf:Description>
|
||||||
|
<rdf:Description rdf:about=""
|
||||||
|
xmlns:xmpTPg="http://ns.adobe.com/xap/1.0/t/pg/"
|
||||||
|
xmlns:stDim="http://ns.adobe.com/xap/1.0/sType/Dimensions#"
|
||||||
|
xmlns:xmpG="http://ns.adobe.com/xap/1.0/g/">
|
||||||
|
<xmpTPg:NPages>1</xmpTPg:NPages>
|
||||||
|
<xmpTPg:HasVisibleTransparency>False</xmpTPg:HasVisibleTransparency>
|
||||||
|
<xmpTPg:HasVisibleOverprint>False</xmpTPg:HasVisibleOverprint>
|
||||||
|
<xmpTPg:MaxPageSize rdf:parseType="Resource">
|
||||||
|
<stDim:w>64.000000</stDim:w>
|
||||||
|
<stDim:h>64.000000</stDim:h>
|
||||||
|
<stDim:unit>Points</stDim:unit>
|
||||||
|
</xmpTPg:MaxPageSize>
|
||||||
|
<xmpTPg:PlateNames>
|
||||||
|
<rdf:Seq>
|
||||||
|
<rdf:li>Cyan</rdf:li>
|
||||||
|
<rdf:li>Magenta</rdf:li>
|
||||||
|
<rdf:li>Yellow</rdf:li>
|
||||||
|
<rdf:li>Black</rdf:li>
|
||||||
|
</rdf:Seq>
|
||||||
|
</xmpTPg:PlateNames>
|
||||||
|
<xmpTPg:SwatchGroups>
|
||||||
|
<rdf:Seq>
|
||||||
|
<rdf:li rdf:parseType="Resource">
|
||||||
|
<xmpG:groupName>Default Swatch Group</xmpG:groupName>
|
||||||
|
<xmpG:groupType>0</xmpG:groupType>
|
||||||
|
</rdf:li>
|
||||||
|
</rdf:Seq>
|
||||||
|
</xmpTPg:SwatchGroups>
|
||||||
|
</rdf:Description>
|
||||||
|
<rdf:Description rdf:about=""
|
||||||
|
xmlns:illustrator="http://ns.adobe.com/illustrator/1.0/">
|
||||||
|
<illustrator:Type>Document</illustrator:Type>
|
||||||
|
</rdf:Description>
|
||||||
|
<rdf:Description rdf:about=""
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||||
|
<dc:format>application/pdf</dc:format>
|
||||||
|
<dc:title>
|
||||||
|
<rdf:Alt>
|
||||||
|
<rdf:li xml:lang="x-default">Mongoo 3 smooth green</rdf:li>
|
||||||
|
</rdf:Alt>
|
||||||
|
</dc:title>
|
||||||
|
</rdf:Description>
|
||||||
|
<rdf:Description rdf:about=""
|
||||||
|
xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/">
|
||||||
|
<xmpMM:RenditionClass>proof:pdf</xmpMM:RenditionClass>
|
||||||
|
<xmpMM:DocumentID>uuid:a2f6b830-2598-49b9-8770-4f9fa14f1be3</xmpMM:DocumentID>
|
||||||
|
<xmpMM:InstanceID>uuid:42245d04-b042-4038-b450-94c7cfb8ee6f</xmpMM:InstanceID>
|
||||||
|
</rdf:Description>
|
||||||
|
<rdf:Description rdf:about=""
|
||||||
|
xmlns:pdf="http://ns.adobe.com/pdf/1.3/">
|
||||||
|
<pdf:Producer>Adobe PDF library 10.01</pdf:Producer>
|
||||||
|
</rdf:Description>
|
||||||
|
</rdf:RDF>
|
||||||
|
</x:xmpmeta>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?xpacket end="w"?>
|
||||||
|
endstream␍endobj␍3 0 obj␍<</Count 1/Kids[7 0 R]/Type/Pages>>␍endobj␍7 0 obj␍<</ArtBox[0.643066 4.46875 63.2324 59.6494]/BleedBox[0.0 0.0 64.0 64.0]/Contents 8 0 R/LastModified(D:20130102172747+01'00')/MediaBox[0.0 0.0 64.0 64.0]/Parent 3 0 R/PieceInfo<</Illustrator 9 0 R>>/Resources<</ExtGState<</GS0 10 0 R>>/Properties<</MC0 5 0 R>>>>/Thumb 11 0 R/TrimBox[0.0 0.0 64.0 64.0]/Type/Page>>␍endobj␍8 0 obj␍<</Filter/FlateDecode/Length 1251>>stream
|
||||||
|
H‰t–KŽ•7…çÿ*¼�kì²]¶§!#Y@+�A "±û|§Ü}i"E4}»ü¨Ç©SÇ÷Õ¯¯Ó«·¯Kúéç×éú|•ä]?7þùãú=ýu•Ül¤’»u~7éˇëÕ›÷%}øûúœj*ü«©ö<gÉfÞ{zøtiãÓu«yøL–K[øÍ¥®ÄRK_ÙÂoÌb5ÝêÊ}Xº�\pp«5ouµ§‡ëÖòžø°�}�ÔKøºÕ�7Oß.㪱P
|
||||||
|
Õ¼†‡Ûʹ¯—åÞ,üY›ªhN,Ï«,,ëºjyt#V˶å»äéÆîZ-vw_©åÚ”é¬ÅÙ™{ìŽ<¨¥äíÖÄ/‡ÌG˜»ê°NùЏըÙ#�Îåª"
|
||||||
|
Þw\¨»§ÇËH;ʹ�•¬e¯Ç¡¨qùýþC€Pq¸ù°D,OrµžW·€Ö÷ÔiúÑçk¢EÓmåmç|9Φ%eÒ´Õ,"�CºÍ<F�¬¦ºÛÆÒ�ä¶:Y)žÍ¥;Í6•¨¤h#‘¢À8âɆæŽ>Ò»\µ¢(JØ\›^v@_ÈŸ=,ñ<•Ûf€³pÒÈÐOǽˆ!,L÷XèKå²ÐK‹nP.6mj~X±ì,¬ÚO»è. 6oDh:�œw:ĉ G‡a÷Ȃh½žŠ`ÖhJ˃,¿ÊÁò㱪€1³G›j 'ž6ì„55WÌ`mu��¢¼E*âdžpƒyé\„—¤×-C*�ß›s�ÐД'ÜÁ"=E‚N’ÕÓS¹¥B€à¤êÇ«“ÇàôŽšî64nSxq~Žž åÄŸî×%›D£†³SMSqXcXÕöV¹␍Ö[¶&Žê–è)øÜ¼˜ì…~¨␍H–8Â]@ôVí">vñ°„Ikw»,ãP0QºIl†§k[jHž ñªaµc¸èg-¢2*u]Ù | ||||||