X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;f=parsers.c;h=6b922d72c5a8c3ac34220e94dcf127cbfc4b1ece;hb=d9be112e8353413208b1ed009c9541e334ea7fb2;hp=c6f9c66fd8d15c5733fd8d7a1d1de14e6a099ccb;hpb=5a9b2f2a5e613ab160a4a59df74ff5b4833ae42f;p=privoxy.git diff --git a/parsers.c b/parsers.c index c6f9c66f..6b922d72 100644 --- a/parsers.c +++ b/parsers.c @@ -1,4 +1,4 @@ -const char parsers_rcs[] = "$Id: parsers.c,v 1.66 2006/09/03 19:38:28 fabiankeil Exp $"; +const char parsers_rcs[] = "$Id: parsers.c,v 1.70 2006/09/08 12:06:34 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/parsers.c,v $ @@ -40,6 +40,31 @@ const char parsers_rcs[] = "$Id: parsers.c,v 1.66 2006/09/03 19:38:28 fabiankeil * * Revisions : * $Log: parsers.c,v $ + * Revision 1.70 2006/09/08 12:06:34 fabiankeil + * Have hide-if-modified-since interpret the random + * range value as minutes instead of hours. Allows + * more fine-grained configuration. + * + * Revision 1.69 2006/09/06 16:25:51 fabiankeil + * Always have parse_header_time return a pointer + * that actual makes sense, even though we currently + * only need it to detect problems. + * + * Revision 1.68 2006/09/06 10:43:32 fabiankeil + * Added config option enable-remote-http-toggle + * to specify if Privoxy should recognize special + * headers (currently only X-Filter) to change its + * behaviour. Disabled by default. + * + * Revision 1.67 2006/09/04 11:01:26 fabiankeil + * After filtering de-chunked instances, remove + * "Transfer-Encoding" header entirely instead of changing + * it to "Transfer-Encoding: identity", which is invalid. + * Thanks Michael Shields . Fixes PR 1318658. + * + * Don't use localtime in parse_header_time. An empty time struct + * is good enough, it gets overwritten by strptime anyway. + * * Revision 1.66 2006/09/03 19:38:28 fabiankeil * Use gmtime_r if available, fallback to gmtime with mutex * protection for MacOSX and use vanilla gmtime for the rest. @@ -2292,16 +2317,16 @@ jb_err client_if_modified_since(struct client_state *csp, char **header) else { rtime = strtol(newval, &endptr, 0); - if(rtime < 0) - { - rtime *= -1; - negative = 1; - } if(rtime) { - log_error(LOG_LEVEL_HEADER, "Randomizing: %s (random range: %d hou%s)", - *header, rtime, (rtime == 1 || rtime == -1) ? "r": "rs"); - rtime *= 3600; + log_error(LOG_LEVEL_HEADER, "Randomizing: %s (random range: %d minut%s)", + *header, rtime, (rtime == 1 || rtime == -1) ? "e": "es"); + if(rtime < 0) + { + rtime *= -1; + negative = 1; + } + rtime *= 60; rtime = pick_from_range(rtime); } else @@ -2309,7 +2334,7 @@ jb_err client_if_modified_since(struct client_state *csp, char **header) log_error(LOG_LEVEL_ERROR, "Random range is 0. Assuming time transformation test.", *header); } - tm += rtime; + tm += rtime * (negative ? -1 : 1); #ifdef HAVE_GMTIME_R timeptr = gmtime_r(&tm, &gmt); #elif OSX_DARWIN @@ -2397,17 +2422,24 @@ jb_err client_x_filter(struct client_state *csp, char **header) { if ( 0 == strcmpic(*header, "X-Filter: No")) { - if (csp->action->flags & ACTION_FORCE_TEXT_MODE) + if (!(csp->config->feature_flags & RUNTIME_FEATURE_HTTP_TOGGLE)) { - log_error(LOG_LEVEL_HEADER, "force-text-mode overruled the client's request to disable filtering!"); + log_error(LOG_LEVEL_INFO, "Ignored the client's request to fetch without filtering."); } - else - { - csp->content_type = CT_TABOO; - log_error(LOG_LEVEL_HEADER, "Disabled filter mode on behalf of the client."); + else + { + if (csp->action->flags & ACTION_FORCE_TEXT_MODE) + { + log_error(LOG_LEVEL_HEADER, "force-text-mode overruled the client's request to fetch without filtering!"); + } + else + { + csp->content_type = CT_TABOO; + log_error(LOG_LEVEL_HEADER, "Accepted the client's request to fetch without filtering."); + } + log_error(LOG_LEVEL_HEADER, "Crunching %s", *header); + freez(*header); } - log_error(LOG_LEVEL_HEADER, "Crunching %s", *header); - freez(*header); } return JB_ERR_OK; } @@ -2890,6 +2922,7 @@ struct tm *parse_header_time(char *header, time_t *tm) { else { *tm = timegm(&gmt); + timeptr=&gmt; } return(timeptr); }