Commit 3feab3a1 authored by Deomid Ryabkov's avatar Deomid Ryabkov Committed by Cesanta Bot

No-JS mode refactoring

Now JS is controlled with a make variable as opposed to a proproc define.

This allows skipping compiling a whole bunch of files when JS is
disabled, e.g. whole freezing step on ESP, or compiling v7.c on CC3200
which takes a while only to be discarded in its entirety later.

Var name is SJ_ENABLE_JS (note change from disable logic to enable to be in line with other stuff). Default is 1, meaning JS is enabled.

Also changed clubby knob in the same way: SJ_ENABLE_CLUBBY, default is 1 as well.

PUBLISHED_FROM=105277e9536e423d6363a51ff9acea9550a9c496
parent 5d76e57b
...@@ -6,40 +6,40 @@ signature: | ...@@ -6,40 +6,40 @@ signature: |
void mg_set_protocol_http_websocket(struct mg_connection *nc); void mg_set_protocol_http_websocket(struct mg_connection *nc);
--- ---
Attaches a built-in HTTP event handler to the given connection. Attach built-in HTTP event handler to the given connection.
The user-defined event handler will receive following extra events: User-defined event handler will receive following extra events:
- MG_EV_HTTP_REQUEST: HTTP request has arrived. Parsed HTTP request - MG_EV_HTTP_REQUEST: HTTP request has arrived. Parsed HTTP request
is passed as is passed as
`struct http_message` through the handler's `void *ev_data` pointer. `struct http_message` through the handler's `void *ev_data` pointer.
- MG_EV_HTTP_MULTIPART_REQUEST: A multipart POST request has received. - MG_EV_HTTP_MULTIPART_REQUEST: A multipart POST request has received.
This event is sent before body is parsed. After this, the user This event is sent before body is parsed. After this user
should expect a sequence of MG_EV_HTTP_PART_BEGIN/DATA/END requests. should expect a sequence of MG_EV_HTTP_PART_BEGIN/DATA/END requests.
This is also the last time when headers and other request fields are This is also the last time when headers and other request fields are
accessible. accessible.
- MG_EV_HTTP_REPLY: The HTTP reply has arrived. The parsed HTTP reply is passed as - MG_EV_HTTP_REPLY: HTTP reply has arrived. Parsed HTTP reply is passed as
`struct http_message` through the handler's `void *ev_data` pointer. `struct http_message` through the handler's `void *ev_data` pointer.
- MG_EV_HTTP_CHUNK: The HTTP chunked-encoding chunk has arrived. - MG_EV_HTTP_CHUNK: HTTP chunked-encoding chunk has arrived.
The parsed HTTP reply is passed as `struct http_message` through the Parsed HTTP reply is passed as `struct http_message` through the
handler's `void *ev_data` pointer. `http_message::body` would contain handler's `void *ev_data` pointer. `http_message::body` would contain
incomplete, reassembled HTTP body. incomplete, reassembled HTTP body.
It will grow with every new chunk that arrives, and it can It will grow with every new chunk arrived, and
potentially consume a lot of memory. An event handler may process potentially can consume a lot of memory. An event handler may process
the body as chunks are coming, and signal Mongoose to delete processed the body as chunks are coming, and signal Mongoose to delete processed
body by setting `MG_F_DELETE_CHUNK` in `mg_connection::flags`. When body by setting `MG_F_DELETE_CHUNK` in `mg_connection::flags`. When
the last zero chunk is received, the last zero chunk is received,
Mongoose sends `MG_EV_HTTP_REPLY` event with Mongoose sends `MG_EV_HTTP_REPLY` event with
full reassembled body (if handler did not signal to delete chunks) or full reassembled body (if handler did not signal to delete chunks) or
with empty body (if handler did signal to delete chunks). with empty body (if handler did signal to delete chunks).
- MG_EV_WEBSOCKET_HANDSHAKE_REQUEST: server has received the WebSocket handshake - MG_EV_WEBSOCKET_HANDSHAKE_REQUEST: server has received websocket handshake
request. `ev_data` contains parsed HTTP request. request. `ev_data` contains parsed HTTP request.
- MG_EV_WEBSOCKET_HANDSHAKE_DONE: server has completed the WebSocket handshake. - MG_EV_WEBSOCKET_HANDSHAKE_DONE: server has completed Websocket handshake.
`ev_data` is `NULL`. `ev_data` is `NULL`.
- MG_EV_WEBSOCKET_FRAME: new WebSocket frame has arrived. `ev_data` is - MG_EV_WEBSOCKET_FRAME: new websocket frame has arrived. `ev_data` is
`struct websocket_message *` `struct websocket_message *`
- MG_EV_HTTP_PART_BEGIN: new part of multipart message is started, - MG_EV_HTTP_PART_BEGIN: new part of multipart message is started,
extra parameters are passed in mg_http_multipart_part extra parameters are passed in mg_http_multipart_part
- MG_EV_HTTP_PART_DATA: new portion of data from the multiparted message - MG_EV_HTTP_PART_DATA: new portion of data from multiparted message
no additional headers are available, only data and data size no additional headers are available, only data and data size
- MG_EV_HTTP_PART_END: final boundary received, analogue to maybe used to - MG_EV_HTTP_PART_END: final boundary received, analogue to maybe used to
find the end of packet find the end of packet
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment