X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=filters.c;h=49a9e89318d36e82bf4fa9f44a1968f73457db2d;hp=c3aa3fd34491e0827a95f921335ae607b25c3d70;hb=1af23a5f61918ef6b1c17cc95cb621b0177a824b;hpb=d6f6d40eb51a7a7f491c5c027f83bbd7f44c009f diff --git a/filters.c b/filters.c index c3aa3fd3..49a9e893 100644 --- a/filters.c +++ b/filters.c @@ -1,4 +1,4 @@ -const char filters_rcs[] = "$Id: filters.c,v 1.200 2016/02/26 12:29:38 fabiankeil Exp $"; +const char filters_rcs[] = "$Id: filters.c,v 1.203 2016/12/24 16:00:49 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/filters.c,v $ @@ -82,7 +82,6 @@ const char filters_h_rcs[] = FILTERS_H_VERSION; typedef char *(*filter_function_ptr)(); static filter_function_ptr get_filter_function(const struct client_state *csp); -static jb_err remove_chunked_transfer_coding(char *buffer, size_t *size); static jb_err prepare_for_filtering(struct client_state *csp); static void apply_url_actions(struct current_action_spec *action, struct http_request *http, @@ -935,6 +934,7 @@ pcrs_job *compile_dynamic_pcrs_job_list(const struct client_state *csp, const st {"path", csp->http->path, 1}, {"host", csp->http->host, 1}, {"origin", csp->ip_addr_str, 1}, + {"listen-address", csp->listen_addr_str, 1}, {NULL, NULL, 1} }; @@ -1327,42 +1327,18 @@ struct http_response *redirect_url(struct client_state *csp) * * Function : is_imageurl * - * Description : Given a URL, decide whether it is an image or not, - * using either the info from a previous +image action - * or, #ifdef FEATURE_IMAGE_DETECT_MSIE, and the browser - * is MSIE and not on a Mac, tell from the browser's accept - * header. + * Description : Given a URL, decide whether it should be treated + * as image URL or not. * * Parameters : * 1 : csp = Current client state (buffers, headers, etc...) * - * Returns : True (nonzero) if URL is an image, false (0) + * Returns : True (nonzero) if URL is an image URL, false (0) * otherwise * *********************************************************************/ int is_imageurl(const struct client_state *csp) { -#ifdef FEATURE_IMAGE_DETECT_MSIE - char *tmp; - - tmp = get_header_value(csp->headers, "User-Agent:"); - if (tmp && strstr(tmp, "MSIE") && !strstr(tmp, "Mac_")) - { - tmp = get_header_value(csp->headers, "Accept:"); - if (tmp && strstr(tmp, "image/gif")) - { - /* Client will accept HTML. If this seems counterintuitive, - * blame Microsoft. - */ - return(0); - } - else - { - return(1); - } - } -#endif /* def FEATURE_IMAGE_DETECT_MSIE */ - return ((csp->action->flags & ACTION_IMAGE) != 0); } @@ -1771,6 +1747,7 @@ static void set_privoxy_variables(const struct client_state *csp) { "PRIVOXY_PATH", csp->http->path }, { "PRIVOXY_HOST", csp->http->host }, { "PRIVOXY_ORIGIN", csp->ip_addr_str }, + { "PRIVOXY_LISTEN_ADDRESS", csp->listen_addr_str }, }; for (i = 0; i < SZ(env); i++) @@ -1955,7 +1932,11 @@ static char *execute_external_filter(const struct client_state *csp, * or NULL in case something went wrong. * *********************************************************************/ +#ifdef FUZZ +char *gif_deanimate_response(struct client_state *csp) +#else static char *gif_deanimate_response(struct client_state *csp) +#endif { struct binbuffer *in, *out; char *p; @@ -2053,13 +2034,23 @@ static filter_function_ptr get_filter_function(const struct client_state *csp) * JB_ERR_PARSE otherwise * *********************************************************************/ +#ifdef FUZZ +extern jb_err remove_chunked_transfer_coding(char *buffer, size_t *size) +#else static jb_err remove_chunked_transfer_coding(char *buffer, size_t *size) +#endif { size_t newsize = 0; unsigned int chunksize = 0; char *from_p, *to_p; const char *end_of_buffer = buffer + *size; + if (*size == 0) + { + log_error(LOG_LEVEL_FATAL, "Invalid chunked input. Buffer is empty."); + return JB_ERR_PARSE; + } + assert(buffer); from_p = to_p = buffer;