mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-28 20:58:31 +00:00
Added Lua callback
This commit is contained in:
1 parent
31489ab7b1
commit
976b5f37c1
2 files changed
+3
No files matched your search
@@ -3957,6 +3957,8 @@ static void handle_lsp_request(struct connection *conn, const char *path,
|
|||||||
} else {
|
} else {
|
||||||
// We're not sending HTTP headers here, Lua page must do it.
|
// We're not sending HTTP headers here, Lua page must do it.
|
||||||
prepare_lua_environment(&conn->mg_conn, L);
|
prepare_lua_environment(&conn->mg_conn, L);
|
||||||
|
conn->mg_conn.connection_param = L;
|
||||||
|
call_user(conn, MG_LUA);
|
||||||
lua_pushcclosure(L, &lua_error_handler, 0);
|
lua_pushcclosure(L, &lua_error_handler, 0);
|
||||||
lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS);
|
lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS);
|
||||||
lsp(conn, p, (int) st->st_size, L);
|
lsp(conn, p, (int) st->st_size, L);
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ enum mg_event {
|
|||||||
MG_REQUEST, // If callback returns MG_FALSE, Mongoose continues with req
|
MG_REQUEST, // If callback returns MG_FALSE, Mongoose continues with req
|
||||||
MG_REPLY, // If callback returns MG_FALSE, Mongoose closes connection
|
MG_REPLY, // If callback returns MG_FALSE, Mongoose closes connection
|
||||||
MG_CLOSE, // Connection is closed
|
MG_CLOSE, // Connection is closed
|
||||||
|
MG_LUA, // Called before LSP page invoked
|
||||||
MG_HTTP_ERROR // If callback returns MG_FALSE, Mongoose continues with err
|
MG_HTTP_ERROR // If callback returns MG_FALSE, Mongoose continues with err
|
||||||
};
|
};
|
||||||
typedef int (*mg_handler_t)(struct mg_connection *, enum mg_event);
|
typedef int (*mg_handler_t)(struct mg_connection *, enum mg_event);
|
||||||
|
|||||||
Reference in new issue
Block a user