~ubuntu-branches/ubuntu/intrepid/privoxy/intrepid

« back to all changes in this revision

Viewing changes to urlmatch.c

  • Committer: Bazaar Package Importer
  • Author(s): Roland Rosenfeld
  • Date: 2008-01-20 22:19:02 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080120221902-fei8hyw047z11q3s
Tags: 3.0.8-1
* New upstream release 3.0.8-stable.
* Upgrade all patches to new version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.20 2007/09/02 15:31:20 fabiankeil Exp $";
 
1
const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.21 2007/12/24 16:34:23 fabiankeil Exp $";
2
2
/*********************************************************************
3
3
 *
4
4
 * File        :  $Source: /cvsroot/ijbswa/current/urlmatch.c,v $
33
33
 *
34
34
 * Revisions   :
35
35
 *    $Log: urlmatch.c,v $
 
36
 *    Revision 1.21  2007/12/24 16:34:23  fabiankeil
 
37
 *    Band-aid (and micro-optimization) that makes it less likely to run out of
 
38
 *    stack space with overly-complex path patterns. Probably masks the problem
 
39
 *    reported by Lee in #1856679. Hohoho.
 
40
 *
36
41
 *    Revision 1.20  2007/09/02 15:31:20  fabiankeil
37
42
 *    Move match_portlist() from filter.c to urlmatch.c.
38
43
 *    It's used for url matching, not for filtering.
1023
1028
int url_match(const struct url_spec *pattern,
1024
1029
              const struct http_request *url)
1025
1030
{
1026
 
   int port_matches;
1027
 
   int domain_matches;
1028
 
   int path_matches;
 
1031
   /* XXX: these should probably be functions. */
 
1032
#define PORT_MATCHES ((NULL == pattern->port_list) || match_portlist(pattern->port_list, url->port))
 
1033
#define DOMAIN_MATCHES ((NULL == pattern->dbuffer) || (0 == domain_match(pattern, url)))
 
1034
#define PATH_MATCHES ((NULL == pattern->path) || (0 == regexec(pattern->preg, url->path, 0, NULL, 0)))
1029
1035
 
1030
1036
   if (pattern->tag_regex != NULL)
1031
1037
   {
1033
1039
      return 0;
1034
1040
   } 
1035
1041
 
1036
 
   port_matches = (NULL == pattern->port_list) || match_portlist(pattern->port_list, url->port);
1037
 
   domain_matches = (NULL == pattern->dbuffer) || (0 == domain_match(pattern, url));
1038
 
   path_matches = (NULL == pattern->path) || (0 == regexec(pattern->preg, url->path, 0, NULL, 0));
1039
 
 
1040
 
   return (port_matches && domain_matches && path_matches);
 
1042
   return (PORT_MATCHES && DOMAIN_MATCHES && PATH_MATCHES);
1041
1043
 
1042
1044
}
1043
1045