Skip to content

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

@a2ikm

Description

@a2ikm

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions