X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=parsers.c;h=940f45cd4c52a1a59ebc52b331aa3092d6531fb3;hp=e34d6250cf8884ed7f20c1cf738fb9653875fed0;hb=1874e12a0343cc86935d5ce3b544b4b32359d703;hpb=ba08a5ee9e40d95bddd0fcfe2212bf368de36e42 diff --git a/parsers.c b/parsers.c index e34d6250..940f45cd 100644 --- a/parsers.c +++ b/parsers.c @@ -1,4 +1,4 @@ -const char parsers_rcs[] = "$Id: parsers.c,v 1.217 2011/01/22 12:30:22 fabiankeil Exp $"; +const char parsers_rcs[] = "$Id: parsers.c,v 1.218 2011/02/14 16:11:34 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/parsers.c,v $ @@ -2127,6 +2127,12 @@ static jb_err server_transfer_coding(struct client_state *csp, char **header) * The second run is used to remove the Content-Encoding * header if the decompression was successful. * + * XXX: Doesn't properly deal with multiple or with + * unsupported but unknown encodings. + * Is case-sensitive but shouldn't be. + * The second run should be factored out into + * a different function. + * * Parameters : * 1 : csp = Current client state (buffers, headers, etc...) * 2 : header = On input, pointer to header to modify. @@ -2155,6 +2161,26 @@ static jb_err server_content_encoding(struct client_state *csp, char **header) log_error(LOG_LEVEL_HEADER, "Crunching: %s", *header); freez(*header); } + else if (strstr(*header, "sdch")) + { + /* + * Shared Dictionary Compression over HTTP isn't supported, + * filtering it anyway is pretty much guaranteed to mess up + * the encoding. + */ + csp->content_type |= CT_TABOO; + + /* + * Log a warning if the user expects the content to be filtered. + */ + if ((csp->rlist != NULL) && + (!list_is_empty(csp->action->multi[ACTION_MULTI_FILTER]))) + { + log_error(LOG_LEVEL_INFO, + "SDCH-compressed content detected, content filtering disabled. " + "Consider suppressing SDCH offers made by the client."); + } + } else if (strstr(*header, "gzip")) { /* Mark for gzip decompression */ @@ -2174,7 +2200,16 @@ static jb_err server_content_encoding(struct client_state *csp, char **header) csp->content_type |= CT_TABOO; } #else /* !defined(FEATURE_ZLIB) */ - if (strstr(*header, "gzip") || strstr(*header, "compress") || strstr(*header, "deflate")) + /* + * XXX: Using a black list here isn't the right approach. + * + * In case of SDCH, building with zlib support isn't + * going to help. + */ + if (strstr(*header, "gzip") || + strstr(*header, "compress") || + strstr(*header, "deflate") || + strstr(*header, "sdch")) { /* * Body is compressed, turn off pcrs and gif filtering.