diff options
Diffstat (limited to 'nginx/ngx_http_js_module.c')
-rw-r--r-- | nginx/ngx_http_js_module.c | 57 |
1 files changed, 46 insertions, 11 deletions
diff --git a/nginx/ngx_http_js_module.c b/nginx/ngx_http_js_module.c index 40bb83a5..45ddf17e 100644 --- a/nginx/ngx_http_js_module.c +++ b/nginx/ngx_http_js_module.c @@ -433,6 +433,13 @@ static ngx_command_t ngx_http_js_commands[] = { offsetof(ngx_http_js_loc_conf_t, reuse), NULL }, + { ngx_string("js_context_reuse_max_size"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_conf_set_size_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_js_loc_conf_t, reuse_max_size), + NULL }, + { ngx_string("js_import"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE13, ngx_js_import, @@ -2448,6 +2455,8 @@ ngx_http_js_ext_send_header(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs, return NJS_ERROR; } + r->disable_not_modified = 1; + if (ngx_http_send_header(r) == NGX_ERROR) { return NJS_ERROR; } @@ -2731,6 +2740,8 @@ ngx_http_js_ext_return(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs, cv.value.data = text.start; cv.value.len = text.length; + r->disable_not_modified = 1; + ctx->status = ngx_http_send_response(r, status, NULL, &cv); if (ctx->status == NGX_ERROR) { @@ -5438,6 +5449,8 @@ ngx_http_qjs_ext_return(JSContext *cx, JSValueConst this_val, cv.value.data = body.data; cv.value.len = body.len; + r->disable_not_modified = 1; + ctx->status = ngx_http_send_response(r, status, NULL, &cv); if (ctx->status == NGX_ERROR) { @@ -5663,6 +5676,8 @@ ngx_http_qjs_ext_send_header(JSContext *cx, JSValueConst this_val, return JS_ThrowInternalError(cx, "failed to set content type"); } + r->disable_not_modified = 1; + if (ngx_http_send_header(r) == NGX_ERROR) { return JS_ThrowInternalError(cx, "failed to send header"); } @@ -7684,21 +7699,12 @@ ngx_http_js_init(ngx_conf_t *cf) static ngx_int_t -ngx_http_js_init_worker(ngx_cycle_t *cycle) +ngx_http_js_init_worker_periodics(ngx_js_main_conf_t *jmcf) { ngx_uint_t i; ngx_js_periodic_t *periodics; - ngx_js_main_conf_t *jmcf; - - if ((ngx_process != NGX_PROCESS_WORKER) - && ngx_process != NGX_PROCESS_SINGLE) - { - return NGX_OK; - } - - jmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_js_module); - if (jmcf == NULL || jmcf->periodics == NULL) { + if (jmcf->periodics == NULL) { return NGX_OK; } @@ -7726,6 +7732,35 @@ ngx_http_js_init_worker(ngx_cycle_t *cycle) } +static ngx_int_t +ngx_http_js_init_worker(ngx_cycle_t *cycle) +{ + ngx_js_main_conf_t *jmcf; + + if ((ngx_process != NGX_PROCESS_WORKER) + && ngx_process != NGX_PROCESS_SINGLE) + { + return NGX_OK; + } + + jmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_js_module); + + if (jmcf == NULL) { + return NGX_OK; + } + + if (ngx_http_js_init_worker_periodics(jmcf) != NGX_OK) { + return NGX_ERROR; + } + + if (ngx_js_dict_init_worker(jmcf) != NGX_OK) { + return NGX_ERROR; + } + + return NGX_OK; +} + + static char * ngx_http_js_periodic(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { |