Skip to content

Commit c89cb14

Browse files
committed
update && bugfix
1 parent 9cebb13 commit c89cb14

File tree

4 files changed

+124
-4
lines changed

4 files changed

+124
-4
lines changed

module/ngx_http_cpp_module/ngx_http_cpp_module.cpp

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static void *ngx_http_cpp_create_conf(ngx_conf_t *cf)
7878
return NGX_CONF_ERROR;
7979
}
8080

81-
static ngx_int_t ngx_http_cpp_handler(ngx_http_request_t *r)
81+
static ngx_int_t ngx_http_cpp_module_handler(ngx_http_request_t *r)
8282
{
8383
ngx_http_cpp_loc_conf_t *conf = (ngx_http_cpp_loc_conf_t *)ngx_http_get_module_loc_conf(r, ngx_http_cpp_module);
8484

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

126+
static void ngx_http_cpp_body_handler(ngx_http_request_t *r)
127+
{
128+
ngx_http_finalize_request(r, ngx_http_cpp_module_handler(r));
129+
}
130+
131+
static ngx_int_t ngx_http_cpp_handler(ngx_http_request_t *r)
132+
{
133+
if (r->headers_in.content_length_n > 0)
134+
{
135+
ngx_http_core_loc_conf_t *clcf = (ngx_http_core_loc_conf_t *)ngx_http_get_module_loc_conf(r, ngx_http_core_module);
136+
if (clcf->client_body_buffer_size < (size_t)clcf->client_max_body_size)
137+
{
138+
clcf->client_body_buffer_size = clcf->client_max_body_size;
139+
}
140+
r->request_body_in_single_buf = 1;
141+
r->request_body_file_log_level = 0;
142+
ngx_int_t rc = ngx_http_read_client_request_body(r, ngx_http_cpp_body_handler);
143+
if (rc >= NGX_HTTP_SPECIAL_RESPONSE)
144+
{
145+
return rc;
146+
}
147+
return NGX_DONE;
148+
}
149+
else
150+
{
151+
ngx_http_discard_request_body(r);
152+
return ngx_http_cpp_module_handler(r);
153+
}
154+
}
155+
126156
static char *ngx_http_cpp_load(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
127157
{
128158
ngx_http_core_loc_conf_t *clcf;

module/ngx_http_java_module/ngx_http_java_module.cpp

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static void *ngx_http_java_create_conf(ngx_conf_t *cf)
101101
return NGX_CONF_ERROR;
102102
}
103103

104-
static ngx_int_t ngx_http_java_handler(ngx_http_request_t *r)
104+
static ngx_int_t ngx_http_java_module_handler(ngx_http_request_t *r)
105105
{
106106
ngx_http_java_loc_conf_t *conf = (ngx_http_java_loc_conf_t *)ngx_http_get_module_loc_conf(r, ngx_http_java_module);
107107

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

149+
static void ngx_http_java_body_handler(ngx_http_request_t *r)
150+
{
151+
ngx_http_finalize_request(r, ngx_http_java_module_handler(r));
152+
}
153+
154+
static ngx_int_t ngx_http_java_handler(ngx_http_request_t *r)
155+
{
156+
if (r->headers_in.content_length_n > 0)
157+
{
158+
ngx_http_core_loc_conf_t *clcf = (ngx_http_core_loc_conf_t *)ngx_http_get_module_loc_conf(r, ngx_http_core_module);
159+
if (clcf->client_body_buffer_size < (size_t)clcf->client_max_body_size)
160+
{
161+
clcf->client_body_buffer_size = clcf->client_max_body_size;
162+
}
163+
r->request_body_in_single_buf = 1;
164+
r->request_body_file_log_level = 0;
165+
ngx_int_t rc = ngx_http_read_client_request_body(r, ngx_http_java_body_handler);
166+
if (rc >= NGX_HTTP_SPECIAL_RESPONSE)
167+
{
168+
return rc;
169+
}
170+
return NGX_DONE;
171+
}
172+
else
173+
{
174+
ngx_http_discard_request_body(r);
175+
return ngx_http_java_module_handler(r);
176+
}
177+
}
178+
149179
static char *ngx_http_java_load(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
150180
{
151181
ngx_http_core_loc_conf_t *clcf;

module/ngx_http_lua_module/ngx_http_lua_module.cpp

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static void *ngx_http_lua_create_conf(ngx_conf_t *cf)
9393
return NGX_CONF_ERROR;
9494
}
9595

96-
static ngx_int_t ngx_http_lua_handler(ngx_http_request_t *r)
96+
static ngx_int_t ngx_http_lua_module_handler(ngx_http_request_t *r)
9797
{
9898
ngx_http_lua_loc_conf_t *conf = (ngx_http_lua_loc_conf_t *)ngx_http_get_module_loc_conf(r, ngx_http_lua_module);
9999

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

141+
static void ngx_http_lua_body_handler(ngx_http_request_t *r)
142+
{
143+
ngx_http_finalize_request(r, ngx_http_lua_module_handler(r));
144+
}
145+
146+
static ngx_int_t ngx_http_lua_handler(ngx_http_request_t *r)
147+
{
148+
if (r->headers_in.content_length_n > 0)
149+
{
150+
ngx_http_core_loc_conf_t *clcf = (ngx_http_core_loc_conf_t *)ngx_http_get_module_loc_conf(r, ngx_http_core_module);
151+
if (clcf->client_body_buffer_size < (size_t)clcf->client_max_body_size)
152+
{
153+
clcf->client_body_buffer_size = clcf->client_max_body_size;
154+
}
155+
r->request_body_in_single_buf = 1;
156+
r->request_body_file_log_level = 0;
157+
ngx_int_t rc = ngx_http_read_client_request_body(r, ngx_http_lua_body_handler);
158+
if (rc >= NGX_HTTP_SPECIAL_RESPONSE)
159+
{
160+
return rc;
161+
}
162+
return NGX_DONE;
163+
}
164+
else
165+
{
166+
ngx_http_discard_request_body(r);
167+
return ngx_http_lua_module_handler(r);
168+
}
169+
}
170+
141171
static char *ngx_http_lua_load(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
142172
{
143173
ngx_http_core_loc_conf_t *clcf;

module/ngx_http_py_module/ngx_http_py_module.cpp

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static void *ngx_http_py_create_conf(ngx_conf_t *cf)
7878
return NGX_CONF_ERROR;
7979
}
8080

81-
static ngx_int_t ngx_http_py_handler(ngx_http_request_t *r)
81+
static ngx_int_t ngx_http_py_module_handler(ngx_http_request_t *r)
8282
{
8383
ngx_http_py_loc_conf_t *conf = (ngx_http_py_loc_conf_t *)ngx_http_get_module_loc_conf(r, ngx_http_py_module);
8484

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

127+
static void ngx_http_py_body_handler(ngx_http_request_t *r)
128+
{
129+
ngx_http_finalize_request(r, ngx_http_py_module_handler(r));
130+
}
131+
132+
static ngx_int_t ngx_http_py_handler(ngx_http_request_t *r)
133+
{
134+
if (r->headers_in.content_length_n > 0)
135+
{
136+
ngx_http_core_loc_conf_t *clcf = (ngx_http_core_loc_conf_t *)ngx_http_get_module_loc_conf(r, ngx_http_core_module);
137+
if (clcf->client_body_buffer_size < (size_t)clcf->client_max_body_size)
138+
{
139+
clcf->client_body_buffer_size = clcf->client_max_body_size;
140+
}
141+
r->request_body_in_single_buf = 1;
142+
r->request_body_file_log_level = 0;
143+
ngx_int_t rc = ngx_http_read_client_request_body(r, ngx_http_py_body_handler);
144+
if (rc >= NGX_HTTP_SPECIAL_RESPONSE)
145+
{
146+
return rc;
147+
}
148+
return NGX_DONE;
149+
}
150+
else
151+
{
152+
ngx_http_discard_request_body(r);
153+
return ngx_http_py_module_handler(r);
154+
}
155+
}
156+
127157
static char *ngx_http_py_load(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
128158
{
129159
ngx_http_core_loc_conf_t *clcf;

0 commit comments

Comments
 (0)