Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return statement in do ... end block and for loops causes LocalJumpError #502

Open
a2ikm opened this issue Feb 1, 2023 · 0 comments
Open

Comments

@a2ikm
Copy link

a2ikm commented Feb 1, 2023

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: a2ikm#2

@a2ikm a2ikm changed the title return statement in each and for loops causes LocalJumpError return statement in do...end block and for loops causes LocalJumpError Feb 1, 2023
@a2ikm a2ikm changed the title return statement in do...end block and for loops causes LocalJumpError return statement in do ... end block and for loops causes LocalJumpError Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant