Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

bugfix: requests would hang when nginx subrequests were used in the s…

…ame location because ngx_http_run_posted_requests was never called by anyone. thanks stonehuzhan for reporting this issue.
  • Loading branch information...
commit 178f0494939bc338e5da7bdd7377efe8dfa7e881 1 parent 6fad9d1
@agentzh authored
Showing with 57 additions and 2 deletions.
  1. +8 −2 src/ngx_http_chunkin_filter_module.c
  2. +47 −0 t/bug.t
  3. +2 −0  util/build.sh
View
10 src/ngx_http_chunkin_filter_module.c
@@ -359,7 +359,13 @@ ngx_http_chunkin_resume_handler(ngx_http_request_t *r) {
return rc;
}
- return ngx_http_chunkin_internal_redirect(r, &r->main->uri, &r->main->args,
- ctx);
+ rc = ngx_http_chunkin_internal_redirect(r, &r->main->uri, &r->main->args,
+ ctx);
+
+ /* ngx_http_process_request calls this to handle subrequests,
+ * so we need to call it here as well */
+ ngx_http_run_posted_requests(r->connection);
+
+ return rc;
}
View
47 t/bug.t
@@ -649,3 +649,50 @@ hello\r
--- error_code: 411
--- SKIP
+
+
+=== TEST 28: did not work with subrequests
+--- config
+ chunkin on;
+
+ error_page 411 = @my_411_error;
+ location @my_411_error {
+ chunkin_resume;
+ }
+
+ location = /t {
+ content_by_lua_file html/a.lua;
+ }
+
+ location = /sub {
+ echo hello world;
+ }
+--- user_files
+>>> a.lua
+ngx.req.read_body()
+local res = ngx.location.capture("/sub")
+ngx.say("sr: ", res.status)
+--- raw_request eval
+"POST /t HTTP/1.1\r
+Host: localhost\r
+Transfer-Encoding: chunked\r
+\r
+5\r
+hello\r
+0\r
+\r
+"
+--- more_headers
+Transfer-Encoding: chunked
+--- stap2
+F(ngx_http_finalize_request) {
+ if ($r->main->count >= 3) {
+ printf("============ %d\n", $r->main->count)
+ print_ubacktrace()
+ }
+}
+--- response_body_body
+sr: 200
+--- no_error_log
+[error]
+
View
2  util/build.sh
@@ -14,7 +14,9 @@ force=$2
ngx-build $force $version \
--with-cc-opt="-funsigned-char" \
+ --with-ld-opt="-L$PCRE_LIB -Wl,-rpath,$PCRE_LIB:$LUAJIT_LIB:/usr/local/lib" \
--add-module=$root/../echo-nginx-module \
+ --add-module=$root/../lua-nginx-module \
--add-module=$root $opts \
--with-debug
#\
Please sign in to comment.
Something went wrong with that request. Please try again.