mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-08 16:11:18 +00:00
Adjusted docs and makefile to use correct preproc flags
This commit is contained in:
1 parent
67b7d79710
commit
2ea17e8c6d
3 files changed
+15
-9
No files matched your search
+11
-6
@@ -84,12 +84,12 @@ of the websocket frame which URI handler can examine. Note that to
|
|||||||
reply to the websocket client, `mg_websocket_write()` should be used.
|
reply to the websocket client, `mg_websocket_write()` should be used.
|
||||||
To reply to the plain HTTP client, `mg_write_data()` should be used.
|
To reply to the plain HTTP client, `mg_write_data()` should be used.
|
||||||
|
|
||||||
An URI handler must return a value. If 0 is return, that signals Mongoose
|
An URI handler must return a value. If URI handler has sent all data,
|
||||||
|
it should return `1`. If URI handler returns `0`, that signals Mongoose
|
||||||
that URI handler hasn't finished sending data to the client. In this case,
|
that URI handler hasn't finished sending data to the client. In this case,
|
||||||
Mongoose will call URI handler after each successful socket write.
|
Mongoose will call URI handler after each successful socket write.
|
||||||
`struct mg_connection::wsbits` flag will indicate the status of the write,
|
`struct mg_connection::wsbits` flag will indicate the status of the write,
|
||||||
`1` means that write has failed and connection will be closed. If URI
|
`1` means that write has failed and connection will be closed.
|
||||||
handler has sent all data, it should return `1`.
|
|
||||||
|
|
||||||
void mg_set_http_error_handler(struct mg_server *, mg_handler_t);
|
void mg_set_http_error_handler(struct mg_server *, mg_handler_t);
|
||||||
|
|
||||||
@@ -141,7 +141,13 @@ a response body. Mongoose provides functions for all three parts:
|
|||||||
* `mg_send_data()` and `mg_printf_data()` are used to send data to the
|
* `mg_send_data()` and `mg_printf_data()` are used to send data to the
|
||||||
client. Note that Mongoose adds `Transfer-Encoding: chunked` header
|
client. Note that Mongoose adds `Transfer-Encoding: chunked` header
|
||||||
implicitly, and sends data in chunks. Therefore, it is not necessary to
|
implicitly, and sends data in chunks. Therefore, it is not necessary to
|
||||||
set `Content-Length` header.
|
set `Content-Length` header. Note that `mg_send_data()` and
|
||||||
|
`mg_printf_data()` do not send data immediately. Instead, they spool
|
||||||
|
data in memory, and Mongoose sends that data later after URI handler
|
||||||
|
returns. If data to be sent is huge, an URI handler might
|
||||||
|
send data in pieces by saving state in
|
||||||
|
`struct mg_connection::connection_param` variable and returning `0`. Then
|
||||||
|
Mongoose will call a handler repeatedly after each socket write.
|
||||||
|
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
|
||||||
@@ -149,8 +155,7 @@ a response body. Mongoose provides functions for all three parts:
|
|||||||
const char *data, size_t data_len);
|
const char *data, size_t data_len);
|
||||||
|
|
||||||
Similar to `mg_write()`, but wraps the data into a websocket frame with a
|
Similar to `mg_write()`, but wraps the data into a websocket frame with a
|
||||||
given websocket `opcode`. This function is available when mongoose is
|
given websocket `opcode`.
|
||||||
compiled with `-DUSE_WEBSOCKET`.
|
|
||||||
|
|
||||||
const char *mg_get_header(const struct mg_connection *, const char *name);
|
const char *mg_get_header(const struct mg_connection *, const char *name);
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,9 @@ a couple of kilobytes to the executable size, and also has some runtime penalty.
|
|||||||
rejected, not set by default
|
rejected, not set by default
|
||||||
-DMONGOOSE_USE_EXTRA_HTTP_HEADERS=X Append X to the HTTP headers
|
-DMONGOOSE_USE_EXTRA_HTTP_HEADERS=X Append X to the HTTP headers
|
||||||
for static files, empty by default
|
for static files, empty by default
|
||||||
|
-DMONGOOSE_USE_STACK_SIZE=X Let mg_start_thread() use stack
|
||||||
|
size X, default is OS default
|
||||||
|
-DMONGOOSE_ENABLE_DEBUG Enables debug messages on stdout, very noisy
|
||||||
|
|
||||||
Mongoose source code contains a well-commented example code, listed below:
|
Mongoose source code contains a well-commented example code, listed below:
|
||||||
|
|
||||||
|
|||||||
+1
-3
@@ -27,7 +27,6 @@ all: websocket_html.c
|
|||||||
$(CC) auth.c ../mongoose.c -o auth $(CFLAGS)
|
$(CC) auth.c ../mongoose.c -o auth $(CFLAGS)
|
||||||
$(CC) server.c ../mongoose.c -o server $(CFLAGS)
|
$(CC) server.c ../mongoose.c -o server $(CFLAGS)
|
||||||
|
|
||||||
# $(CC) -DUSE_WEBSOCKET websocket.c ../mongoose.c -o $@ $(CFLAGS)
|
|
||||||
# $(CC) chat.c ../mongoose.c -o chat $(CFLAGS)
|
# $(CC) chat.c ../mongoose.c -o chat $(CFLAGS)
|
||||||
# $(CC) lua_dll.c ../build/lua_5.2.1.c -o $@.so $(CFLAGS) $(DLL_FLAGS)
|
# $(CC) lua_dll.c ../build/lua_5.2.1.c -o $@.so $(CFLAGS) $(DLL_FLAGS)
|
||||||
|
|
||||||
@@ -36,7 +35,7 @@ websocket_html.c: websocket.html
|
|||||||
|
|
||||||
MSVC = ../../vc6
|
MSVC = ../../vc6
|
||||||
CL = $(MSVC)/bin/cl
|
CL = $(MSVC)/bin/cl
|
||||||
CLFLAGS = /MD /TC /nologo $(DBG) /W3 /DNO_SSL \
|
CLFLAGS = /MD /TC /nologo $(DBG) /W3 \
|
||||||
/I$(MSVC)/include /I.. /Dsnprintf=_snprintf
|
/I$(MSVC)/include /I.. /Dsnprintf=_snprintf
|
||||||
LFLAGS = /link /incremental:no /libpath:$(MSVC)/lib /machine:IX86
|
LFLAGS = /link /incremental:no /libpath:$(MSVC)/lib /machine:IX86
|
||||||
|
|
||||||
@@ -49,7 +48,6 @@ windows: websocket_html.c
|
|||||||
$(CL) auth.c ../mongoose.c $(CLFLAGS) $(LFLAGS)
|
$(CL) auth.c ../mongoose.c $(CLFLAGS) $(LFLAGS)
|
||||||
$(CL) server.c ../mongoose.c $(CLFLAGS) $(LFLAGS)
|
$(CL) server.c ../mongoose.c $(CLFLAGS) $(LFLAGS)
|
||||||
|
|
||||||
# $(CL) /DUSE_WEBSOCKET websocket.c ../mongoose.c $(CLFLAGS) $(LFLAGS)
|
|
||||||
#$(CL) lua_dll.c $(CLFLAGS) $(DLL_FLAGS) /DLL $(LFLAGS) /SUBSYSTEM:WINDOWS /ENTRY:luaopen_lua_dll /EXPORT:luaopen_lua_dll /out:lua_dll.dll
|
#$(CL) lua_dll.c $(CLFLAGS) $(DLL_FLAGS) /DLL $(LFLAGS) /SUBSYSTEM:WINDOWS /ENTRY:luaopen_lua_dll /EXPORT:luaopen_lua_dll /out:lua_dll.dll
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|||||||
Reference in new issue
Block a user