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

Indefinite length urls cannot be regularly matched? #30

Open
SenLinLeo opened this issue Aug 13, 2019 · 1 comment
Open

Indefinite length urls cannot be regularly matched? #30

SenLinLeo opened this issue Aug 13, 2019 · 1 comment

Comments

@SenLinLeo
Copy link

SenLinLeo commented Aug 13, 2019

Hey, thanks for this library!
I want to ask a question, I want to routing of the URL is indefinite the length,such as: ip:7500/v1/foo/dir/test/......../test . There may be more levels. So I used regular matching, but.

  1. The POST method can't be used regularly and can't be matched.
  2. If the GET and POST methods are the same as the path, neither method can match.

code:

local r3route     = require "resty.r3"
local router_uri =
  {
      {
         path = "/v1/foo/{get_filename}",
         method = {"GET"},
        handler = main_controllers_get
     },
    {
       path = [[/v1/bar/{bucketname}/{get_filename:([\w-./])}]],
       method = {"GET"},
       handler = main_controllers_get
    },
   {
      path = "/v1/foo",
      method = {"POST"},
      handler = main_controllers_post
   },
  {
      path = [[/v1/bar/{bucketname}/{post_filename:([\w-./])}]],
     method = {"POST"},
     handler = main_controllers_post
   }
 }

 local r3 = r3route.new(router_uri)

 r3:compile()

 local ok = r3:dispatch(ngx.var.uri , ngx.req.get_method())
 if not ok then
    ngx.exit(403)
 end

How do you solve this problem?

@membphis
Copy link
Member

replied you: #28 (comment)

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

2 participants