Skip to content

Commit

Permalink
bugfix: requests would hang when nginx subrequests were used in the s…
Browse files Browse the repository at this point in the history
…ame location because ngx_http_run_posted_requests was never called by anyone. thanks stonehuzhan for reporting this issue.
  • Loading branch information
agentzh committed Feb 5, 2013
1 parent 6fad9d1 commit 178f049
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/ngx_http_chunkin_filter_module.c
Expand Up @@ -359,7 +359,13 @@ ngx_http_chunkin_resume_handler(ngx_http_request_t *r) {
return rc; return rc;
} }


return ngx_http_chunkin_internal_redirect(r, &r->main->uri, &r->main->args, rc = ngx_http_chunkin_internal_redirect(r, &r->main->uri, &r->main->args,
ctx); 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;
} }


47 changes: 47 additions & 0 deletions t/bug.t
Expand Up @@ -649,3 +649,50 @@ hello\r
--- error_code: 411 --- error_code: 411
--- SKIP --- 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]
2 changes: 2 additions & 0 deletions util/build.sh
Expand Up @@ -14,7 +14,9 @@ force=$2


ngx-build $force $version \ ngx-build $force $version \
--with-cc-opt="-funsigned-char" \ --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/../echo-nginx-module \
--add-module=$root/../lua-nginx-module \
--add-module=$root $opts \ --add-module=$root $opts \
--with-debug --with-debug
#\ #\
Expand Down

0 comments on commit 178f049

Please sign in to comment.