mongoose-cpp
                                
                                 mongoose-cpp copied to clipboard
                                
                                    mongoose-cpp copied to clipboard
                            
                            
                            
                        Bug: regular expression matching doesn't work
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
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.