mirror of
https://github.com/lxsang/ant-http
synced 2025-07-26 10:39:45 +02:00
support of rule, useful for sub domain remapping
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
|
||||
void set_status(int client,int code,const char* msg)
|
||||
{
|
||||
response(client, __s("HTTP/1.0 %d %s", code, msg));
|
||||
response(client, __s("HTTP/1.1 %d %s", code, msg));
|
||||
response(client, __s("Server: %s ", SERVER_NAME));
|
||||
}
|
||||
void redirect(int client,const char*path)
|
||||
|
@ -193,11 +193,11 @@ int is_bin(const char* file)
|
||||
|
||||
int match_int(const char* search)
|
||||
{
|
||||
return regex_match("^[-+]?[0-9]+$",search);
|
||||
return regex_match("^[-+]?[0-9]+$",search,0, NULL);
|
||||
}
|
||||
int match_float(const char* search)
|
||||
{
|
||||
return regex_match("^[+-]?[0-9]*\\.[0-9]+$",search);
|
||||
return regex_match("^[+-]?[0-9]*\\.[0-9]+$",search,0,NULL);
|
||||
}
|
||||
/*
|
||||
regmatch_t matches[MAX_MATCHES];
|
||||
@ -206,7 +206,7 @@ if (regexec(&exp, sz, MAX_MATCHES, matches, 0) == 0) {
|
||||
printf("group1: %s\n", buff);
|
||||
}
|
||||
*/
|
||||
int regex_match(const char* expr,const char* search)
|
||||
int regex_match(const char* expr,const char* search, int msize, regmatch_t* matches)
|
||||
{
|
||||
regex_t regex;
|
||||
int reti;
|
||||
@ -220,7 +220,7 @@ int regex_match(const char* expr,const char* search)
|
||||
}
|
||||
|
||||
/* Execute regular expression */
|
||||
reti = regexec(®ex, search, 0, NULL, 0);
|
||||
reti = regexec(®ex, search, msize, matches, 0);
|
||||
if( !reti ){
|
||||
//LOG("Match");
|
||||
ret = 1;
|
||||
|
@ -84,7 +84,7 @@ char* mime(const char*);
|
||||
int is_bin(const char*);
|
||||
int match_int(const char*);
|
||||
int match_float(const char*);
|
||||
int regex_match(const char*,const char*);
|
||||
int regex_match(const char*,const char*, int, regmatch_t*);
|
||||
char *url_decode(const char *str);
|
||||
char *url_encode(const char *str);
|
||||
char from_hex(char ch);
|
||||
|
Reference in New Issue
Block a user