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

Bug: regular expression matching doesn't work #9

Open
rans1 opened this issue Jan 28, 2014 · 1 comment
Open

Bug: regular expression matching doesn't work #9

rans1 opened this issue Jan 28, 2014 · 1 comment

Comments

@rans1
Copy link

rans1 commented Jan 28, 2014

hi

the fix of url regular expression matching doesn't work in this project.
i have tracked the issue & it seems it doesn't work because of:

bool Controller::handles(string method, string url)
{
string key = method + ":" + url;

    return (routes.find(key) != routes.end()); // << routes is a map 

}

as seen in the code routes is a map & when you try to find a matched url you failed
this function is called before the method:

Response *Controller::process(Request &request)
{
Response *response = NULL;
map<string, RequestHandlerBase *>::iterator it;
for (it=routes.begin(); it!=routes.end(); it++) {
if (request.match(it->first)){
response = it->second->process(request);
break;
}
}
return response;
}

which find a mtach by iterating the map & call request.match

@Gregwar
Copy link
Owner

Gregwar commented Jan 28, 2014

Hello,

I must confess I didn't maintained the regexp matching when I moved to the new mongoose (I had to change mongoose a little to tel if a route is handled or not).
We should also test for matching in handles right now, this is indeed an issue.

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