#ifndef WS_REWRITE_H
#define WS_REWRITE_H
#include "../public/nsapi.h"
#include "../util/strreplace.h"
#include <cx/string.h>
#include <regex.h>
#ifdef __cplusplus
extern "C" {
#endif
#define WS_REWRITE_NMATCH 16
typedef struct RewriteRule {
regex_t regex;
WSBool has_regex;
StringTemplate *url;
} RewriteRule;
RewriteRule* rewrite_rule_create(ServerConfiguration *cfg, cxmutstr regex, cxmutstr url);
int rewrite_url(
RewriteRule *rule,
regmatch_t *match,
int nmatch,
const CxAllocator *a,
const char *url,
char **new_url);
#ifdef __cplusplus
}
#endif
#endif