-const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.60 2011/04/19 13:00:47 fabiankeil Exp $";
+const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.61 2011/05/22 10:25:26 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/urlmatch.c,v $
/*
* Check for * URI. If found, we're done.
- */
+ */
if (*http->url == '*')
{
if ( NULL == (http->path = strdup("*"))
- || NULL == (http->hostport = strdup("")) )
+ || NULL == (http->hostport = strdup("")) )
{
return JB_ERR_MEMORY;
}
* Microsoft webDAV extension for Exchange 2000. See:
* http://lists.w3.org/Archives/Public/w3c-dist-auth/2002JanMar/0001.html
* http://msdn.microsoft.com/library/en-us/wss/wss/_webdav_methods.asp
- */
+ */
"BCOPY", "BMOVE", "BDELETE", "BPROPFIND", "BPROPPATCH",
/*
* Another Microsoft webDAV extension for Exchange 2000. See:
* http://systems.cs.colorado.edu/grunwald/MobileComputing/Papers/draft-cohen-gena-p-base-00.txt
* http://lists.w3.org/Archives/Public/w3c-dist-auth/2002JanMar/0001.html
* http://msdn.microsoft.com/library/en-us/wss/wss/_webdav_methods.asp
- */
+ */
"SUBSCRIBE", "UNSUBSCRIBE", "NOTIFY", "POLL",
/*
* Yet another WebDAV extension, this time for
url->unanchored |= ANCHOR_LEFT;
}
- /*
+ /*
* Split domain into components
*/
url->dbuffer = strdup(host_pattern);
return JB_ERR_MEMORY;
}
- /*
+ /*
* Map to lower case
*/
for (p = url->dbuffer; *p ; p++)
*p = (char)tolower((int)(unsigned char)*p);
}
- /*
+ /*
* Split the domain name into components
*/
url->dcount = ssplit(url->dbuffer, ".", v, SZ(v), 1, 1);
}
else if (url->dcount != 0)
{
- /*
+ /*
* Save a copy of the pointers in dvec
*/
size = (size_t)url->dcount * sizeof(*url->dvec);
-
+
url->dvec = (char **)malloc(size);
if (NULL == url->dvec)
{
{
const unsigned char *pat = (const unsigned char *)pattern;
const unsigned char *txt = (const unsigned char *)text;
- const unsigned char *fallback = pat;
+ const unsigned char *fallback = pat;
int wildcard = 0;
-
+
unsigned char lastchar = 'a';
unsigned i;
unsigned char charmap[32];
-
+
while (*txt)
{
}
/* '*' in the pattern? */
- if (*pat == '*')
+ if (*pat == '*')
{
-
+
/* The pattern ends afterwards? Speed up the return. */
if (*++pat == '\0')
{
return 0;
}
-
+
/* Else, set wildcard mode and remember position after '*' */
wildcard = 1;
fallback = pat;
while (*++pat != ']')
{
if (!*pat)
- {
+ {
return 1;
}
else if (*pat == '-')
for (i = lastchar; i <= *pat; i++)
{
charmap[i / 8] |= (unsigned char)(1 << (i % 8));
- }
+ }
}
else
{
} /* -END- if Character range specification */
- /*
- * Char match, or char range match?
+ /*
+ * Char match, or char range match?
*/
if ( (*pat == *txt)
|| (*pat == '?')
|| ((*pat == ']') && (charmap[*txt / 8] & (1 << (*txt % 8)))) )
{
- /*
+ /*
* Success: Go ahead
*/
pat++;
}
else if (!wildcard)
{
- /*
+ /*
* No match && no wildcard: No luck
*/
return 1;
{
/* It's a tag pattern and shouldn't be matched against URLs */
return 0;
- }
+ }
return (port_matches(http->port, pattern->port_list)
&& host_matches(http, pattern) && path_matches(http->path, pattern));