logo       

current urlmatch.c,1.20,1.21: msg#00065

web.privoxy.cvs

Subject: current urlmatch.c,1.20,1.21

Update of /cvsroot/ijbswa/current
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv18109

Modified Files:
urlmatch.c
Log Message:
Band-aid (and micro-optimization) that makes it less likely to run out of
stack space with overly-complex path patterns. Probably masks the problem
reported by Lee in #1856679. Hohoho.


Index: urlmatch.c
===================================================================
RCS file: /cvsroot/ijbswa/current/urlmatch.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- urlmatch.c 2 Sep 2007 15:31:20 -0000 1.20
+++ urlmatch.c 24 Dec 2007 16:34:23 -0000 1.21
@@ -33,6 +33,11 @@
*
* Revisions :
* $Log$
+ * Revision 1.21 2007/12/24 16:34:23 fabiankeil
+ * Band-aid (and micro-optimization) that makes it less likely to run out of
+ * stack space with overly-complex path patterns. Probably masks the problem
+ * reported by Lee in #1856679. Hohoho.
+ *
* Revision 1.20 2007/09/02 15:31:20 fabiankeil
* Move match_portlist() from filter.c to urlmatch.c.
* It's used for url matching, not for filtering.
@@ -1023,9 +1028,10 @@
int url_match(const struct url_spec *pattern,
const struct http_request *url)
{
- int port_matches;
- int domain_matches;
- int path_matches;
+ /* XXX: these should probably be functions. */
+#define PORT_MATCHES ((NULL == pattern->port_list) ||
match_portlist(pattern->port_list, url->port))
+#define DOMAIN_MATCHES ((NULL == pattern->dbuffer) || (0 ==
domain_match(pattern, url)))
+#define PATH_MATCHES ((NULL == pattern->path) || (0 == regexec(pattern->preg,
url->path, 0, NULL, 0)))

if (pattern->tag_regex != NULL)
{
@@ -1033,11 +1039,7 @@
return 0;
}

- port_matches = (NULL == pattern->port_list) ||
match_portlist(pattern->port_list, url->port);
- domain_matches = (NULL == pattern->dbuffer) || (0 == domain_match(pattern,
url));
- path_matches = (NULL == pattern->path) || (0 == regexec(pattern->preg,
url->path, 0, NULL, 0));
-
- return (port_matches && domain_matches && path_matches);
+ return (PORT_MATCHES && DOMAIN_MATCHES && PATH_MATCHES);

}



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise