mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-18 23:53:15 +08:00
Fix compilation with MG_DISABLE_HTTP_WEBSOCKET
Make restful_server and netcat examples compilation tests: - netcat doesn't use HTTP, compile it with MG_DISABLE_HTTP - restful_server doesn't use websocket, compile it with MG_DISABLE_HTTP_WEBSOCKET h/t @labourcier, cesanta/mongoose#665 PUBLISHED_FROM=4494ac3cbd81e8314beb557ab301b4b44c4afb89
This commit is contained in:
parent
dfde5785a6
commit
04a38b446f
@ -1,4 +1,4 @@
|
||||
PROG = nc
|
||||
MODULE_CFLAGS=-DMG_ENABLE_THREADS
|
||||
MODULE_CFLAGS=-DMG_ENABLE_THREADS -DMG_DISABLE_HTTP
|
||||
SSL_LIB=openssl
|
||||
include ../examples.mk
|
||||
|
@ -1,2 +1,3 @@
|
||||
PROG = restful_server
|
||||
MODULE_CFLAGS=-DMG_ENABLE_THREADS -DMG_DISABLE_HTTP_WEBSOCKET
|
||||
include ../examples.mk
|
||||
|
@ -5146,8 +5146,9 @@ void mg_http_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
||||
mg_call(nc, nc->handler, MG_EV_WEBSOCKET_HANDSHAKE_DONE, NULL);
|
||||
mg_websocket_handler(nc, MG_EV_RECV, ev_data);
|
||||
}
|
||||
}
|
||||
#endif /* MG_DISABLE_HTTP_WEBSOCKET */
|
||||
} else if (hm->message.len <= io->len) {
|
||||
else if (hm->message.len <= io->len) {
|
||||
int trigger_ev = nc->listener ? MG_EV_HTTP_REQUEST : MG_EV_HTTP_REPLY;
|
||||
|
||||
/* Whole HTTP message is fully buffered, call event handler */
|
||||
@ -7764,6 +7765,7 @@ struct mg_connection *mg_connect_http(struct mg_mgr *mgr,
|
||||
post_data);
|
||||
}
|
||||
|
||||
#ifndef MG_DISABLE_HTTP_WEBSOCKET
|
||||
struct mg_connection *mg_connect_ws_opt(struct mg_mgr *mgr,
|
||||
mg_event_handler_t ev_handler,
|
||||
struct mg_connect_opts opts,
|
||||
@ -7792,6 +7794,7 @@ struct mg_connection *mg_connect_ws(struct mg_mgr *mgr,
|
||||
memset(&opts, 0, sizeof(opts));
|
||||
return mg_connect_ws_opt(mgr, ev_handler, opts, url, protocol, extra_headers);
|
||||
}
|
||||
#endif /* MG_DISABLE_HTTP_WEBSOCKET */
|
||||
|
||||
size_t mg_parse_multipart(const char *buf, size_t buf_len, char *var_name,
|
||||
size_t var_name_len, char *file_name,
|
||||
|
@ -2127,10 +2127,12 @@ struct mg_http_multipart_part {
|
||||
#define MG_EV_HTTP_CHUNK 102 /* struct http_message * */
|
||||
#define MG_EV_SSI_CALL 105 /* char * */
|
||||
|
||||
#ifndef MG_DISABLE_HTTP_WEBSOCKET
|
||||
#define MG_EV_WEBSOCKET_HANDSHAKE_REQUEST 111 /* NULL */
|
||||
#define MG_EV_WEBSOCKET_HANDSHAKE_DONE 112 /* NULL */
|
||||
#define MG_EV_WEBSOCKET_FRAME 113 /* struct websocket_message * */
|
||||
#define MG_EV_WEBSOCKET_CONTROL_FRAME 114 /* struct websocket_message * */
|
||||
#endif
|
||||
|
||||
#ifdef MG_ENABLE_HTTP_STREAMING_MULTIPART
|
||||
#define MG_EV_HTTP_MULTIPART_REQUEST 121 /* struct http_message */
|
||||
@ -2184,6 +2186,7 @@ struct mg_http_multipart_part {
|
||||
*/
|
||||
void mg_set_protocol_http_websocket(struct mg_connection *nc);
|
||||
|
||||
#ifndef MG_DISABLE_HTTP_WEBSOCKET
|
||||
/*
|
||||
* Send websocket handshake to the server.
|
||||
*
|
||||
@ -2289,6 +2292,7 @@ void mg_send_websocket_framev(struct mg_connection *nc, int op_and_flags,
|
||||
*/
|
||||
void mg_printf_websocket_frame(struct mg_connection *nc, int op_and_flags,
|
||||
const char *fmt, ...);
|
||||
#endif /* MG_DISABLE_HTTP_WEBSOCKET */
|
||||
|
||||
/*
|
||||
* Send buffer `buf` of size `len` to the client using chunked HTTP encoding.
|
||||
|
Loading…
Reference in New Issue
Block a user