projects
/
privoxy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Consistently put the tests between the tested actions and the TAG or URL pattern
[privoxy.git]
/
urlmatch.c
diff --git
a/urlmatch.c
b/urlmatch.c
index
65ae8a1
..
2a1ae8b
100644
(file)
--- a/
urlmatch.c
+++ b/
urlmatch.c
@@
-1,4
+1,4
@@
-const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.
65 2011/11/06 11:41:34
fabiankeil Exp $";
+const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.
71 2012/06/08 15:15:11
fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/urlmatch.c,v $
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/urlmatch.c,v $
@@
-135,11
+135,11
@@
jb_err init_domain_components(struct http_request *http)
/* map to lower case */
for (p = http->dbuffer; *p ; p++)
{
/* map to lower case */
for (p = http->dbuffer; *p ; p++)
{
- *p = (char)
tolower((int)(unsigned char)
*p);
+ *p = (char)
privoxy_tolower(
*p);
}
/* split the domain name into components */
}
/* split the domain name into components */
- http->dcount = ssplit(http->dbuffer, ".", vec, SZ(vec)
, 1, 1
);
+ http->dcount = ssplit(http->dbuffer, ".", vec, SZ(vec));
if (http->dcount <= 0)
{
if (http->dcount <= 0)
{
@@
-154,11
+154,7
@@
jb_err init_domain_components(struct http_request *http)
/* save a copy of the pointers in dvec */
size = (size_t)http->dcount * sizeof(*http->dvec);
/* save a copy of the pointers in dvec */
size = (size_t)http->dcount * sizeof(*http->dvec);
- http->dvec = (char **)malloc(size);
- if (NULL == http->dvec)
- {
- return JB_ERR_MEMORY;
- }
+ http->dvec = malloc_or_die(size);
memcpy(http->dvec, vec, size);
memcpy(http->dvec, vec, size);
@@
-253,8
+249,8
@@
jb_err parse_http_url(const char *url, struct http_request *http, int require_pr
*/
if (*http->url == '*')
{
*/
if (*http->url == '*')
{
- if
(
NULL == (http->path = strdup("*"))
-
|| NULL == (http->hostport = strdup(""))
)
+ if
(
NULL == (http->path = strdup("*"))
+
|| NULL == (http->hostport = strdup(""))
)
{
return JB_ERR_MEMORY;
}
{
return JB_ERR_MEMORY;
}
@@
-337,8
+333,8
@@
jb_err parse_http_url(const char *url, struct http_request *http, int require_pr
freez(buf);
freez(buf);
- if (
(http->path == NULL)
-
|| (http->hostport == NULL))
+ if ((http->path == NULL)
+ || (http->hostport == NULL))
{
return JB_ERR_MEMORY;
}
{
return JB_ERR_MEMORY;
}
@@
-530,7
+526,7
@@
jb_err parse_http_request(const char *req, struct http_request *http)
return JB_ERR_MEMORY;
}
return JB_ERR_MEMORY;
}
- n = ssplit(buf, " \r\n", v, SZ(v)
, 1, 1
);
+ n = ssplit(buf, " \r\n", v, SZ(v));
if (n != 3)
{
freez(buf);
if (n != 3)
{
freez(buf);
@@
-581,7
+577,7
@@
jb_err parse_http_request(const char *req, struct http_request *http)
if ( (http->cmd == NULL)
|| (http->gpc == NULL)
if ( (http->cmd == NULL)
|| (http->gpc == NULL)
- || (http->ver == NULL)
)
+ || (http->ver == NULL))
{
return JB_ERR_MEMORY;
}
{
return JB_ERR_MEMORY;
}
@@
-841,13
+837,13
@@
static jb_err compile_host_pattern(struct url_spec *url, const char *host_patter
*/
for (p = url->dbuffer; *p ; p++)
{
*/
for (p = url->dbuffer; *p ; p++)
{
- *p = (char)
tolower((int)(unsigned char)
*p);
+ *p = (char)
privoxy_tolower(
*p);
}
/*
* Split the domain name into components
*/
}
/*
* Split the domain name into components
*/
- url->dcount = ssplit(url->dbuffer, ".", v, SZ(v)
, 1, 1
);
+ url->dcount = ssplit(url->dbuffer, ".", v, SZ(v));
if (url->dcount < 0)
{
if (url->dcount < 0)
{
@@
-861,12
+857,7
@@
static jb_err compile_host_pattern(struct url_spec *url, const char *host_patter
*/
size = (size_t)url->dcount * sizeof(*url->dvec);
*/
size = (size_t)url->dcount * sizeof(*url->dvec);
- url->dvec = (char **)malloc(size);
- if (NULL == url->dvec)
- {
- free_url_spec(url);
- return JB_ERR_MEMORY;
- }
+ url->dvec = malloc_or_die(size);
memcpy(url->dvec, v, size);
}
memcpy(url->dvec, v, size);
}
@@
-971,9
+962,9
@@
static int simplematch(const char *pattern, const char *text)
/*
* Char match, or char range match?
*/
/*
* Char match, or char range match?
*/
- if (
(*pat == *txt)
-
||
(*pat == '?')
-
|| ((*pat == ']') && (charmap[*txt / 8] & (1 << (*txt % 8))))
)
+ if ((*pat == *txt)
+
||
(*pat == '?')
+
|| ((*pat == ']') && (charmap[*txt / 8] & (1 << (*txt % 8))))
)
{
/*
* Success: Go ahead
{
/*
* Success: Go ahead
@@
-1009,7
+1000,7
@@
static int simplematch(const char *pattern, const char *text)
}
/* Cut off extra '*'s */
}
/* Cut off extra '*'s */
- if
(*pat == '*')
pat++;
+ if
(*pat == '*')
pat++;
/* If this is the pattern's end, fine! */
return(*pat);
/* If this is the pattern's end, fine! */
return(*pat);
@@
-1374,7
+1365,7
@@
int match_portlist(const char *portlist, int port)
* or, if max was omitted, between min and 65K
*/
*max++ = '\0';
* or, if max was omitted, between min and 65K
*/
*max++ = '\0';
- if(port >= atoi(min) && port <= (atoi(max) ? atoi(max) : 65535))
+ if
(port >= atoi(min) && port <= (atoi(max) ? atoi(max) : 65535))
{
freez(portlist_copy);
return(1);
{
freez(portlist_copy);
return(1);