X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=urlmatch.c;h=1b2aee86f89733797c03cb35383e3daeceee1291;hp=bdc58ee6e01afb7ad8f7fc1ce95cd8f2eeb89ede;hb=ed7e5327924ec7d200fe324f3a2a074091941836;hpb=f357ea34c073cbbaf5cd9077c0dee0a5a2560440 diff --git a/urlmatch.c b/urlmatch.c index bdc58ee6..1b2aee86 100644 --- a/urlmatch.c +++ b/urlmatch.c @@ -1,4 +1,4 @@ -const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.7 2002/03/26 22:29:55 swa Exp $"; +const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.9 2002/04/04 00:36:36 gliptak Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/urlmatch.c,v $ @@ -33,6 +33,12 @@ const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.7 2002/03/26 22:29:55 swa Exp $ * * Revisions : * $Log: urlmatch.c,v $ + * Revision 1.9 2002/04/04 00:36:36 gliptak + * always use pcre for matching + * + * Revision 1.8 2002/04/03 23:32:47 jongfoster + * Fixing memory leak on error + * * Revision 1.7 2002/03/26 22:29:55 swa * we have a new homepage! * @@ -97,19 +103,6 @@ const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.7 2002/03/26 22:29:55 swa Exp $ const char urlmatch_h_rcs[] = URLMATCH_H_VERSION; -/* Fix a problem with Solaris. There should be no effect on other - * platforms. - * Solaris's isspace() is a macro which uses it's argument directly - * as an array index. Therefore we need to make sure that high-bit - * characters generate +ve values, and ideally we also want to make - * the argument match the declared parameter type of "int". - * - * Why did they write a character function that can't take a simple - * "char" argument? Doh! - */ -#define ijb_isupper(__X) isupper((int)(unsigned char)(__X)) -#define ijb_tolower(__X) tolower((int)(unsigned char)(__X)) - /********************************************************************* * @@ -635,7 +628,6 @@ jb_err create_url_spec(struct url_spec * url, const char * buf) url->path = NULL; url->pathlen = 0; } -#ifdef REGEX if (url->path) { int errcode; @@ -674,7 +666,6 @@ jb_err create_url_spec(struct url_spec * url, const char * buf) return JB_ERR_PARSE; } } -#endif if ((p = strchr(buf, ':')) == NULL) { url->port = 0; @@ -707,10 +698,8 @@ jb_err create_url_spec(struct url_spec * url, const char * buf) { freez(url->spec); freez(url->path); -#ifdef REGEX regfree(url->preg); freez(url->preg); -#endif /* def REGEX */ return JB_ERR_MEMORY; } @@ -727,10 +716,8 @@ jb_err create_url_spec(struct url_spec * url, const char * buf) { freez(url->spec); freez(url->path); -#ifdef REGEX regfree(url->preg); freez(url->preg); -#endif /* def REGEX */ freez(url->dbuffer); url->dcount = 0; return JB_ERR_MEMORY; @@ -746,10 +733,8 @@ jb_err create_url_spec(struct url_spec * url, const char * buf) { freez(url->spec); freez(url->path); -#ifdef REGEX regfree(url->preg); freez(url->preg); -#endif /* def REGEX */ freez(url->dbuffer); url->dcount = 0; return JB_ERR_MEMORY; @@ -785,14 +770,11 @@ void free_url_spec(struct url_spec *url) freez(url->dbuffer); freez(url->dvec); freez(url->path); -#ifdef REGEX if (url->preg) { regfree(url->preg); freez(url->preg); } -#endif - } @@ -815,11 +797,7 @@ int url_match(const struct url_spec *pattern, return ((pattern->port == 0) || (pattern->port == url->port)) && ((pattern->dbuffer == NULL) || (domain_match(pattern, url) == 0)) && ((pattern->path == NULL) || -#ifdef REGEX (regexec(pattern->preg, url->path, 0, NULL, 0) == 0) -#else - (strncmp(pattern->path, url->path, pattern->pathlen) == 0) -#endif ); }