projects
/
privoxy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Recycle debug bit 4 for Tagging-related messages
[privoxy.git]
/
parsers.c
diff --git
a/parsers.c
b/parsers.c
index
cafbd36
..
185db7d
100644
(file)
--- a/
parsers.c
+++ b/
parsers.c
@@
-440,7
+440,7
@@
static jb_err decompress_iob_with_brotli(struct client_state *csp)
if (decoded_buffer == NULL)
{
log_error(LOG_LEVEL_ERROR,
if (decoded_buffer == NULL)
{
log_error(LOG_LEVEL_ERROR,
- "Failed to allocate %
d
bytes for Brotli decompression",
+ "Failed to allocate %
lu
bytes for Brotli decompression",
decoded_buffer_size);
return JB_ERR_MEMORY;
}
decoded_buffer_size);
return JB_ERR_MEMORY;
}
@@
-461,7
+461,7
@@
static jb_err decompress_iob_with_brotli(struct client_state *csp)
csp->iob->size = decoded_buffer_size;
log_error(LOG_LEVEL_RE_FILTER,
csp->iob->size = decoded_buffer_size;
log_error(LOG_LEVEL_RE_FILTER,
- "Decompression successful. Old size: %
d, new size: %d
.",
+ "Decompression successful. Old size: %
lu, new size: %lu
.",
encoded_size, decoded_size);
return JB_ERR_OK;
encoded_size, decoded_size);
return JB_ERR_OK;
@@
-526,7
+526,7
@@
jb_err decompress_iob(struct client_state *csp)
* but it should(?) be valid for deflated data also.
*/
log_error(LOG_LEVEL_ERROR,
* but it should(?) be valid for deflated data also.
*/
log_error(LOG_LEVEL_ERROR,
- "Insufficient data to start decompression. Bytes in buffer: %d",
+ "Insufficient data to start decompression. Bytes in buffer: %
l
d",
csp->iob->eod - csp->iob->cur);
return JB_ERR_COMPRESS;
}
csp->iob->eod - csp->iob->cur);
return JB_ERR_COMPRESS;
}
@@
-817,7
+817,7
@@
jb_err decompress_iob(struct client_state *csp)
* Make sure the new uncompressed iob obeys some minimal
* consistency conditions.
*/
* Make sure the new uncompressed iob obeys some minimal
* consistency conditions.
*/
- if ((csp->iob->buf <=
csp->iob->cur)
+ if ((csp->iob->buf <= csp->iob->cur)
&& (csp->iob->cur <= csp->iob->eod)
&& (csp->iob->eod <= csp->iob->buf + csp->iob->size))
{
&& (csp->iob->cur <= csp->iob->eod)
&& (csp->iob->eod <= csp->iob->buf + csp->iob->size))
{
@@
-825,7
+825,7
@@
jb_err decompress_iob(struct client_state *csp)
if (new_size > (size_t)0)
{
log_error(LOG_LEVEL_RE_FILTER,
if (new_size > (size_t)0)
{
log_error(LOG_LEVEL_RE_FILTER,
- "Decompression successful. Old size: %
d, new size: %d
.",
+ "Decompression successful. Old size: %
lu, new size: %lu
.",
old_size, new_size);
}
else
old_size, new_size);
}
else
@@
-838,10
+838,7
@@
jb_err decompress_iob(struct client_state *csp)
else
{
/* It seems that zlib did something weird. */
else
{
/* It seems that zlib did something weird. */
- log_error(LOG_LEVEL_ERROR,
- "Unexpected error decompressing the buffer (iob): %d==%d, %d>%d, %d<%d",
- csp->iob->cur, csp->iob->buf + skip_size, csp->iob->eod, csp->iob->buf,
- csp->iob->eod, csp->iob->buf + csp->iob->size);
+ log_error(LOG_LEVEL_ERROR, "Inconsistent buffer after decompression");
return JB_ERR_COMPRESS;
}
return JB_ERR_COMPRESS;
}
@@
-1519,7
+1516,7
@@
static jb_err header_tagger(struct client_state *csp, char *header)
assert(NULL != header);
log_error(LOG_LEVEL_ERROR,
"Problems with tagger \'%s\' and header \'%s\': %s",
assert(NULL != header);
log_error(LOG_LEVEL_ERROR,
"Problems with tagger \'%s\' and header \'%s\': %s",
- b->name,
*
header, pcrs_strerror(hits));
+ b->name, header, pcrs_strerror(hits));
}
freez(modified_tag);
}
}
freez(modified_tag);
}
@@
-1543,6
+1540,15
@@
static jb_err header_tagger(struct client_state *csp, char *header)
continue;
}
continue;
}
+ if (list_contains_item(csp->action->multi[ACTION_MULTI_SUPPRESS_TAG], tag))
+ {
+ log_error(LOG_LEVEL_HEADER,
+ "Tagger \'%s\' didn't add tag \'%s\': suppressed",
+ b->name, tag);
+ freez(tag);
+ continue;
+ }
+
if (!list_contains_item(csp->tags, tag))
{
if (JB_ERR_OK != enlist(csp->tags, tag))
if (!list_contains_item(csp->tags, tag))
{
if (JB_ERR_OK != enlist(csp->tags, tag))
@@
-1550,7
+1556,7
@@
static jb_err header_tagger(struct client_state *csp, char *header)
log_error(LOG_LEVEL_ERROR,
"Insufficient memory to add tag \'%s\', "
"based on tagger \'%s\' and header \'%s\'",
log_error(LOG_LEVEL_ERROR,
"Insufficient memory to add tag \'%s\', "
"based on tagger \'%s\' and header \'%s\'",
- tag, b->name,
*
header);
+ tag, b->name, header);
}
else
{
}
else
{
@@
-1670,7
+1676,7
@@
static jb_err filter_header(struct client_state *csp, char **header)
continue;
}
continue;
}
- log_error(LOG_LEVEL_RE_FILTER, "filtering \'%s\' (size %
d
) with \'%s\' ...",
+ log_error(LOG_LEVEL_RE_FILTER, "filtering \'%s\' (size %
lu
) with \'%s\' ...",
*header, size, b->name);
/* Apply all jobs from the joblist */
*header, size, b->name);
/* Apply all jobs from the joblist */
@@
-1704,7
+1710,8
@@
static jb_err filter_header(struct client_state *csp, char **header)
if (b->dynamic) pcrs_free_joblist(joblist);
if (b->dynamic) pcrs_free_joblist(joblist);
- log_error(LOG_LEVEL_RE_FILTER, "... produced %d hits (new size %d).", current_hits, size);
+ log_error(LOG_LEVEL_RE_FILTER,
+ "... produced %d hits (new size %lu).", current_hits, size);
hits += current_hits;
}
hits += current_hits;
}
@@
-2909,7
+2916,7
@@
static jb_err server_last_modified(struct client_state *csp, char **header)
seconds = rtime % 60;
log_error(LOG_LEVEL_HEADER,
seconds = rtime % 60;
log_error(LOG_LEVEL_HEADER,
- "Randomized: %s (added %
d da%s %d hou%s %d minut%s %
d second%s",
+ "Randomized: %s (added %
ld da%s %ld hou%s %ld minut%s %l
d second%s",
*header, days, (days == 1) ? "y" : "ys", hours, (hours == 1) ? "r" : "rs",
minutes, (minutes == 1) ? "e" : "es", seconds, (seconds == 1) ? ")" : "s)");
}
*header, days, (days == 1) ? "y" : "ys", hours, (hours == 1) ? "r" : "rs",
minutes, (minutes == 1) ? "e" : "es", seconds, (seconds == 1) ? ")" : "s)");
}
@@
-3561,7
+3568,7
@@
static jb_err client_if_modified_since(struct client_state *csp, char **header)
if (rtime)
{
if (rtime)
{
- log_error(LOG_LEVEL_HEADER, "Randomizing: %s (random range: %d minut%s)",
+ log_error(LOG_LEVEL_HEADER, "Randomizing: %s (random range: %
l
d minut%s)",
*header, rtime, (rtime == 1 || rtime == -1) ? "e": "es");
if (negative_range)
{
*header, rtime, (rtime == 1 || rtime == -1) ? "e": "es");
if (negative_range)
{
@@
-3572,8
+3579,8
@@
static jb_err client_if_modified_since(struct client_state *csp, char **header)
}
else
{
}
else
{
- log_error(LOG_LEVEL_ERROR,
"Random range is 0. Assuming time transformation test.",
-
*header
);
+ log_error(LOG_LEVEL_ERROR,
+
"Random range is 0. Assuming time transformation test."
);
}
tm += rtime * (negative_range ? -1 : 1);
timeptr = privoxy_gmtime_r(&tm, &gmt);
}
tm += rtime * (negative_range ? -1 : 1);
timeptr = privoxy_gmtime_r(&tm, &gmt);
@@
-3601,7
+3608,7
@@
static jb_err client_if_modified_since(struct client_state *csp, char **header)
seconds = rtime % 60;
log_error(LOG_LEVEL_HEADER,
seconds = rtime % 60;
log_error(LOG_LEVEL_HEADER,
- "Randomized: %s (%s %
d hou%s %d minut%s %
d second%s",
+ "Randomized: %s (%s %
ld hou%s %ld minut%s %l
d second%s",
*header, (negative_range) ? "subtracted" : "added", hours,
(hours == 1) ? "r" : "rs", minutes, (minutes == 1) ? "e" : "es",
seconds, (seconds == 1) ? ")" : "s)");
*header, (negative_range) ? "subtracted" : "added", hours,
(hours == 1) ? "r" : "rs", minutes, (minutes == 1) ? "e" : "es",
seconds, (seconds == 1) ? ")" : "s)");
@@
-4069,7
+4076,8
@@
static jb_err server_http(struct client_state *csp, char **header)
return JB_ERR_PARSE;
}
return JB_ERR_PARSE;
}
- if (csp->http->status == 206)
+ if (csp->http->status == 101 ||
+ csp->http->status == 206)
{
csp->content_type = CT_TABOO;
}
{
csp->content_type = CT_TABOO;
}
@@
-4499,7
+4507,7
@@
static jb_err parse_header_time(const char *header_time, time_t *result)
if (*result != result2)
{
log_error(LOG_LEVEL_ERROR, "strftime() and strptime() disagree. "
if (*result != result2)
{
log_error(LOG_LEVEL_ERROR, "strftime() and strptime() disagree. "
- "Format: '%s'. In: '%s', out: '%s'. %
d != %
d. Rejecting.",
+ "Format: '%s'. In: '%s', out: '%s'. %
ld != %l
d. Rejecting.",
time_formats[i], header_time, recreated_date, *result, result2);
continue;
}
time_formats[i], header_time, recreated_date, *result, result2);
continue;
}
@@
-4588,7
+4596,11
@@
jb_err get_destination_from_headers(const struct list *headers, struct http_requ
return JB_ERR_PARSE;
}
return JB_ERR_PARSE;
}
- p = strdup_or_die(host);
+ p = string_tolower(host);
+ if (p == NULL)
+ {
+ return JB_ERR_MEMORY;
+ }
chomp(p);
q = strdup_or_die(p);
chomp(p);
q = strdup_or_die(p);
@@
-4675,7
+4687,11
@@
jb_err get_destination_from_https_headers(const struct list *headers, struct htt
return JB_ERR_PARSE;
}
return JB_ERR_PARSE;
}
- p = strdup_or_die(host);
+ p = string_tolower(host);
+ if (p == NULL)
+ {
+ return JB_ERR_MEMORY;
+ }
chomp(p);
q = strdup_or_die(p);
chomp(p);
q = strdup_or_die(p);
@@
-4836,6
+4852,10
@@
static jb_err handle_conditional_hide_referrer_parameter(char **header,
referer[hostlength+17] = '\0';
}
referer_url = strstr(referer, "http://");
referer[hostlength+17] = '\0';
}
referer_url = strstr(referer, "http://");
+ if (NULL == referer_url)
+ {
+ referer_url = strstr(referer, "https://");
+ }
if ((NULL == referer_url) || (NULL == strstr(referer_url, host)))
{
/* Host has changed, Referer is invalid or a https URL. */
if ((NULL == referer_url) || (NULL == strstr(referer_url, host)))
{
/* Host has changed, Referer is invalid or a https URL. */