projects
/
privoxy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Upgrade an URL to https
[privoxy.git]
/
parsers.c
diff --git
a/parsers.c
b/parsers.c
index
a16487a
..
eab5e76
100644
(file)
--- a/
parsers.c
+++ b/
parsers.c
@@
-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);
}
@@
-1550,7
+1547,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
+1667,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
+1701,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
+2907,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
+3559,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
+3570,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
+3599,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
+4067,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
+4498,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
+4587,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
+4678,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);