cfe8526ec8
* Add Uri with support for staticUri, regexUri and globUri * Add newline to end of files * Update example * Suppress gcc warnings (unused params)
23 lines
543 B
C++
23 lines
543 B
C++
#ifndef URI_GLOB_H
|
|
#define URI_GLOB_H
|
|
|
|
#include "Uri.h"
|
|
#include <fnmatch.h>
|
|
|
|
class UriGlob : public Uri {
|
|
|
|
public:
|
|
explicit UriGlob(const char *uri) : Uri(uri) {};
|
|
explicit UriGlob(const String &uri) : Uri(uri) {};
|
|
|
|
Uri* clone() const override final {
|
|
return new UriGlob(_uri);
|
|
};
|
|
|
|
bool canHandle(const String &requestUri, __attribute__((unused)) std::vector<String> &pathArgs) override final {
|
|
return fnmatch(_uri.c_str(), requestUri.c_str(), 0) == 0;
|
|
}
|
|
};
|
|
|
|
#endif
|