ngx_mruby
ngx_mruby copied to clipboard
return statement in do ... end block and for loops causes LocalJumpError
For example, the following locations cause LocalJumpError at their return
statements and return 500 Internal Server Error.
location /enable_return_from_block {
mruby_rewrite_handler_code '
[0].each do |_|
r = Nginx::Request.new
r.headers_out["Location"] = "http://example.com"
Nginx.return Nginx::HTTP_MOVED_TEMPORARILY
return
end
';
}
location /enable_return_from_for_statement {
mruby_rewrite_handler_code '
for _ in [0]
r = Nginx::Request.new
r.headers_out["Location"] = "http://example.com"
Nginx.return Nginx::HTTP_MOVED_TEMPORARILY
return
end
';
}
Please check my test results, too: https://github.com/a2ikm/ngx_mruby/pull/2