Skip to content

Bug: regular expression matching doesn't work #9

@rans1

Description

@rans1

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

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