mirror of
https://github.com/lammertb/libhttp.git
synced 2025-08-09 03:22:45 +03:00
Separated timeout for websocket and other requests (2/2)
This commit is contained in:
@@ -889,6 +889,9 @@ enum {
|
||||
REWRITE,
|
||||
HIDE_FILES,
|
||||
REQUEST_TIMEOUT,
|
||||
#if defined(USE_WEBSOCKET)
|
||||
WEBSOCKET_TIMEOUT,
|
||||
#endif
|
||||
DECODE_URL,
|
||||
|
||||
#if defined(USE_LUA)
|
||||
@@ -941,6 +944,9 @@ static struct mg_option config_options[] = {
|
||||
{"url_rewrite_patterns", CONFIG_TYPE_STRING, NULL},
|
||||
{"hide_files_patterns", CONFIG_TYPE_EXT_PATTERN, NULL},
|
||||
{"request_timeout_ms", CONFIG_TYPE_NUMBER, "30000"},
|
||||
#if defined(USE_WEBSOCKET)
|
||||
{"websocket_timeout_ms", CONFIG_TYPE_NUMBER, "30000"},
|
||||
#endif
|
||||
{"decode_url", CONFIG_TYPE_BOOLEAN, "yes"},
|
||||
|
||||
#if defined(USE_LUA)
|
||||
@@ -6810,7 +6816,10 @@ static void read_websocket(struct mg_connection *conn,
|
||||
unsigned char mop; /* mask flag and opcode */
|
||||
double timeout = -1.0;
|
||||
|
||||
if (conn->ctx->config[REQUEST_TIMEOUT]) {
|
||||
if (conn->ctx->config[WEBSOCKET_TIMEOUT]) {
|
||||
timeout = atoi(conn->ctx->config[WEBSOCKET_TIMEOUT]) / 1000.0;
|
||||
}
|
||||
if ((timeout<=0.0) && (conn->ctx->config[REQUEST_TIMEOUT])) {
|
||||
timeout = atoi(conn->ctx->config[REQUEST_TIMEOUT]) / 1000.0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user