X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=parsers.c;h=eab5e76bdf8e37293891e1fea7f2d6ee57a2578f;hp=cafbd364b00c100f9748627101779d75b466fd9a;hb=5b7649ee2d603c8f6d1b3a53834cd767276c8916;hpb=7b9c359a30e24fbd340964f548ecbb28040e874d diff --git a/parsers.c b/parsers.c index cafbd364..eab5e76b 100644 --- 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, - "Failed to allocate %d bytes for Brotli decompression", + "Failed to allocate %lu bytes for Brotli decompression", 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, - "Decompression successful. Old size: %d, new size: %d.", + "Decompression successful. Old size: %lu, new size: %lu.", 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, - "Insufficient data to start decompression. Bytes in buffer: %d", + "Insufficient data to start decompression. Bytes in buffer: %ld", 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. */ - 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)) { @@ -825,7 +825,7 @@ jb_err decompress_iob(struct client_state *csp) 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 @@ -838,10 +838,7 @@ jb_err decompress_iob(struct client_state *csp) 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; } @@ -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", - b->name, *header, pcrs_strerror(hits)); + b->name, header, pcrs_strerror(hits)); } 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\'", - tag, b->name, *header); + tag, b->name, header); } else { @@ -1670,7 +1667,7 @@ static jb_err filter_header(struct client_state *csp, char **header) 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 */ @@ -1704,7 +1701,8 @@ static jb_err filter_header(struct client_state *csp, char **header) 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; } @@ -2909,7 +2907,7 @@ static jb_err server_last_modified(struct client_state *csp, char **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 %ld second%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) { - log_error(LOG_LEVEL_HEADER, "Randomizing: %s (random range: %d minut%s)", + log_error(LOG_LEVEL_HEADER, "Randomizing: %s (random range: %ld minut%s)", *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 { - 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); @@ -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, - "Randomized: %s (%s %d hou%s %d minut%s %d second%s", + "Randomized: %s (%s %ld hou%s %ld minut%s %ld second%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; } - if (csp->http->status == 206) + if (csp->http->status == 101 || + csp->http->status == 206) { 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. " - "Format: '%s'. In: '%s', out: '%s'. %d != %d. Rejecting.", + "Format: '%s'. In: '%s', out: '%s'. %ld != %ld. Rejecting.", 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; } - p = strdup_or_die(host); + p = string_tolower(host); + if (p == NULL) + { + return JB_ERR_MEMORY; + } 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; } - p = strdup_or_die(host); + p = string_tolower(host); + if (p == NULL) + { + return JB_ERR_MEMORY; + } chomp(p); q = strdup_or_die(p);