Skip to content

Commit

Permalink
update && bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
webcpp committed Dec 21, 2023
1 parent 9cebb13 commit c89cb14
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 4 deletions.
32 changes: 31 additions & 1 deletion module/ngx_http_cpp_module/ngx_http_cpp_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static void *ngx_http_cpp_create_conf(ngx_conf_t *cf)
return NGX_CONF_ERROR;
}

static ngx_int_t ngx_http_cpp_handler(ngx_http_request_t *r)
static ngx_int_t ngx_http_cpp_module_handler(ngx_http_request_t *r)
{
ngx_http_cpp_loc_conf_t *conf = (ngx_http_cpp_loc_conf_t *)ngx_http_get_module_loc_conf(r, ngx_http_cpp_module);

Expand Down Expand Up @@ -123,6 +123,36 @@ static ngx_int_t ngx_http_cpp_handler(ngx_http_request_t *r)
return hi::set_output_headers_body(r, res, conf->expires, lru_cache_key);
}

static void ngx_http_cpp_body_handler(ngx_http_request_t *r)
{
ngx_http_finalize_request(r, ngx_http_cpp_module_handler(r));
}

static ngx_int_t ngx_http_cpp_handler(ngx_http_request_t *r)
{
if (r->headers_in.content_length_n > 0)
{
ngx_http_core_loc_conf_t *clcf = (ngx_http_core_loc_conf_t *)ngx_http_get_module_loc_conf(r, ngx_http_core_module);
if (clcf->client_body_buffer_size < (size_t)clcf->client_max_body_size)
{
clcf->client_body_buffer_size = clcf->client_max_body_size;
}
r->request_body_in_single_buf = 1;
r->request_body_file_log_level = 0;
ngx_int_t rc = ngx_http_read_client_request_body(r, ngx_http_cpp_body_handler);
if (rc >= NGX_HTTP_SPECIAL_RESPONSE)
{
return rc;
}
return NGX_DONE;
}
else
{
ngx_http_discard_request_body(r);
return ngx_http_cpp_module_handler(r);
}
}

static char *ngx_http_cpp_load(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
ngx_http_core_loc_conf_t *clcf;
Expand Down
32 changes: 31 additions & 1 deletion module/ngx_http_java_module/ngx_http_java_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ static void *ngx_http_java_create_conf(ngx_conf_t *cf)
return NGX_CONF_ERROR;
}

static ngx_int_t ngx_http_java_handler(ngx_http_request_t *r)
static ngx_int_t ngx_http_java_module_handler(ngx_http_request_t *r)
{
ngx_http_java_loc_conf_t *conf = (ngx_http_java_loc_conf_t *)ngx_http_get_module_loc_conf(r, ngx_http_java_module);

Expand Down Expand Up @@ -146,6 +146,36 @@ static ngx_int_t ngx_http_java_handler(ngx_http_request_t *r)
return hi::set_output_headers_body(r, res, conf->expires, lru_cache_key);
}

static void ngx_http_java_body_handler(ngx_http_request_t *r)
{
ngx_http_finalize_request(r, ngx_http_java_module_handler(r));
}

static ngx_int_t ngx_http_java_handler(ngx_http_request_t *r)
{
if (r->headers_in.content_length_n > 0)
{
ngx_http_core_loc_conf_t *clcf = (ngx_http_core_loc_conf_t *)ngx_http_get_module_loc_conf(r, ngx_http_core_module);
if (clcf->client_body_buffer_size < (size_t)clcf->client_max_body_size)
{
clcf->client_body_buffer_size = clcf->client_max_body_size;
}
r->request_body_in_single_buf = 1;
r->request_body_file_log_level = 0;
ngx_int_t rc = ngx_http_read_client_request_body(r, ngx_http_java_body_handler);
if (rc >= NGX_HTTP_SPECIAL_RESPONSE)
{
return rc;
}
return NGX_DONE;
}
else
{
ngx_http_discard_request_body(r);
return ngx_http_java_module_handler(r);
}
}

static char *ngx_http_java_load(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
ngx_http_core_loc_conf_t *clcf;
Expand Down
32 changes: 31 additions & 1 deletion module/ngx_http_lua_module/ngx_http_lua_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static void *ngx_http_lua_create_conf(ngx_conf_t *cf)
return NGX_CONF_ERROR;
}

static ngx_int_t ngx_http_lua_handler(ngx_http_request_t *r)
static ngx_int_t ngx_http_lua_module_handler(ngx_http_request_t *r)
{
ngx_http_lua_loc_conf_t *conf = (ngx_http_lua_loc_conf_t *)ngx_http_get_module_loc_conf(r, ngx_http_lua_module);

Expand Down Expand Up @@ -138,6 +138,36 @@ static ngx_int_t ngx_http_lua_handler(ngx_http_request_t *r)
return hi::set_output_headers_body(r, res, conf->expires, lru_cache_key);
}

static void ngx_http_lua_body_handler(ngx_http_request_t *r)
{
ngx_http_finalize_request(r, ngx_http_lua_module_handler(r));
}

static ngx_int_t ngx_http_lua_handler(ngx_http_request_t *r)
{
if (r->headers_in.content_length_n > 0)
{
ngx_http_core_loc_conf_t *clcf = (ngx_http_core_loc_conf_t *)ngx_http_get_module_loc_conf(r, ngx_http_core_module);
if (clcf->client_body_buffer_size < (size_t)clcf->client_max_body_size)
{
clcf->client_body_buffer_size = clcf->client_max_body_size;
}
r->request_body_in_single_buf = 1;
r->request_body_file_log_level = 0;
ngx_int_t rc = ngx_http_read_client_request_body(r, ngx_http_lua_body_handler);
if (rc >= NGX_HTTP_SPECIAL_RESPONSE)
{
return rc;
}
return NGX_DONE;
}
else
{
ngx_http_discard_request_body(r);
return ngx_http_lua_module_handler(r);
}
}

static char *ngx_http_lua_load(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
ngx_http_core_loc_conf_t *clcf;
Expand Down
32 changes: 31 additions & 1 deletion module/ngx_http_py_module/ngx_http_py_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static void *ngx_http_py_create_conf(ngx_conf_t *cf)
return NGX_CONF_ERROR;
}

static ngx_int_t ngx_http_py_handler(ngx_http_request_t *r)
static ngx_int_t ngx_http_py_module_handler(ngx_http_request_t *r)
{
ngx_http_py_loc_conf_t *conf = (ngx_http_py_loc_conf_t *)ngx_http_get_module_loc_conf(r, ngx_http_py_module);

Expand Down Expand Up @@ -124,6 +124,36 @@ static ngx_int_t ngx_http_py_handler(ngx_http_request_t *r)
return hi::set_output_headers_body(r, res, conf->expires, lru_cache_key);
}

static void ngx_http_py_body_handler(ngx_http_request_t *r)
{
ngx_http_finalize_request(r, ngx_http_py_module_handler(r));
}

static ngx_int_t ngx_http_py_handler(ngx_http_request_t *r)
{
if (r->headers_in.content_length_n > 0)
{
ngx_http_core_loc_conf_t *clcf = (ngx_http_core_loc_conf_t *)ngx_http_get_module_loc_conf(r, ngx_http_core_module);
if (clcf->client_body_buffer_size < (size_t)clcf->client_max_body_size)
{
clcf->client_body_buffer_size = clcf->client_max_body_size;
}
r->request_body_in_single_buf = 1;
r->request_body_file_log_level = 0;
ngx_int_t rc = ngx_http_read_client_request_body(r, ngx_http_py_body_handler);
if (rc >= NGX_HTTP_SPECIAL_RESPONSE)
{
return rc;
}
return NGX_DONE;
}
else
{
ngx_http_discard_request_body(r);
return ngx_http_py_module_handler(r);
}
}

static char *ngx_http_py_load(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
ngx_http_core_loc_conf_t *clcf;
Expand Down

0 comments on commit c89cb14

Please sign in to comment.