From: Fabian Keil Date: Sat, 20 Sep 2008 10:04:33 +0000 (+0000) Subject: Remove hide-forwarded-for-headers action which has X-Git-Tag: v_3_0_11~240 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=d48514c14861e7f176781c3245b1bc963821e65b Remove hide-forwarded-for-headers action which has been obsoleted by change-x-forwarded-for{block}. --- diff --git a/actionlist.h b/actionlist.h index 60e9b501..62112f8b 100644 --- a/actionlist.h +++ b/actionlist.h @@ -39,6 +39,9 @@ * * Revisions : * $Log: actionlist.h,v $ + * Revision 1.35 2008/09/19 15:43:54 fabiankeil + * Fix sorting. + * * Revision 1.34 2008/09/19 15:26:28 fabiankeil * Add change-x-forwarded-for{} action to block or add * X-Forwarded-For headers. Mostly based on code removed @@ -227,7 +230,6 @@ DEFINE_CGI_PARAM_CUSTOM ("hide-accept-language", ACTION_HIDE_ACCEPT_LANGU DEFINE_ACTION_STRING ("hide-content-disposition", ACTION_HIDE_CONTENT_DISPOSITION, ACTION_STRING_CONTENT_DISPOSITION) DEFINE_CGI_PARAM_RADIO ("hide-content-disposition", ACTION_HIDE_CONTENT_DISPOSITION, ACTION_STRING_CONTENT_DISPOSITION, "block", 0) DEFINE_CGI_PARAM_CUSTOM ("hide-content-disposition", ACTION_HIDE_CONTENT_DISPOSITION, ACTION_STRING_CONTENT_DISPOSITION, "attachment; filename=WHATEVER.txt") -DEFINE_ACTION_BOOL ("hide-forwarded-for-headers", ACTION_HIDE_FORWARDED) DEFINE_ACTION_STRING ("hide-from-header", ACTION_HIDE_FROM, ACTION_STRING_FROM) DEFINE_CGI_PARAM_RADIO ("hide-from-header", ACTION_HIDE_FROM, ACTION_STRING_FROM, "block", 1) DEFINE_CGI_PARAM_CUSTOM ("hide-from-header", ACTION_HIDE_FROM, ACTION_STRING_FROM, "spam_me_senseless@sittingduck.xyz") @@ -281,7 +283,6 @@ DEFINE_ACTION_BOOL ("no-cookie-set", ACTION_NO_COOKIE_SET) DEFINE_ACTION_BOOL ("prevent-reading-cookies", ACTION_NO_COOKIE_READ) DEFINE_ACTION_BOOL ("prevent-setting-cookies", ACTION_NO_COOKIE_SET) DEFINE_ACTION_BOOL ("downgrade", ACTION_DOWNGRADE) -DEFINE_ACTION_BOOL ("hide-forwarded", ACTION_HIDE_FORWARDED) DEFINE_ACTION_STRING ("hide-from", ACTION_HIDE_FROM, ACTION_STRING_FROM) DEFINE_ACTION_BOOL ("image", ACTION_IMAGE) DEFINE_ACTION_STRING ("image-blocker", ACTION_IMAGE_BLOCKER, ACTION_STRING_IMAGE_BLOCKER) diff --git a/actions.c b/actions.c index 7dc34781..a66c4645 100644 --- a/actions.c +++ b/actions.c @@ -1,4 +1,4 @@ -const char actions_rcs[] = "$Id: actions.c,v 1.52 2008/04/27 16:26:59 fabiankeil Exp $"; +const char actions_rcs[] = "$Id: actions.c,v 1.53 2008/05/26 16:04:04 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/actions.c,v $ @@ -33,6 +33,9 @@ const char actions_rcs[] = "$Id: actions.c,v 1.52 2008/04/27 16:26:59 fabiankeil * * Revisions : * $Log: actions.c,v $ + * Revision 1.53 2008/05/26 16:04:04 fabiankeil + * s@memorey@memory@ + * * Revision 1.52 2008/04/27 16:26:59 fabiankeil * White space fix for the last commit. * @@ -872,6 +875,12 @@ jb_err get_actions(char *line, log_error(LOG_LEVEL_ERROR, "Action '%s' is no longer valid " "in this Privoxy release. Ignored.", option+1); } + else if ((2 < strlen(option)) && 0 == strcmpic(option+1, "hide-forwarded-for-headers")) + { + log_error(LOG_LEVEL_FATAL, "The action 'hide-forwarded-for-headers' " + "is no longer valid in this Privoxy release. " + "Use 'change-x-forwarded-for' instead."); + } else { /* Bad action name */ diff --git a/parsers.c b/parsers.c index 77f54af4..921d6184 100644 --- a/parsers.c +++ b/parsers.c @@ -1,4 +1,4 @@ -const char parsers_rcs[] = "$Id: parsers.c,v 1.140 2008/09/12 17:51:43 fabiankeil Exp $"; +const char parsers_rcs[] = "$Id: parsers.c,v 1.141 2008/09/19 15:26:28 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/parsers.c,v $ @@ -44,6 +44,11 @@ const char parsers_rcs[] = "$Id: parsers.c,v 1.140 2008/09/12 17:51:43 fabiankei * * Revisions : * $Log: parsers.c,v $ + * Revision 1.141 2008/09/19 15:26:28 fabiankeil + * Add change-x-forwarded-for{} action to block or add + * X-Forwarded-For headers. Mostly based on code removed + * before 3.0.7. + * * Revision 1.140 2008/09/12 17:51:43 fabiankeil * - A few style fixes. * - Remove a pointless cast. @@ -3373,26 +3378,27 @@ static jb_err client_send_cookie(struct client_state *csp, char **header) *********************************************************************/ jb_err client_x_forwarded(struct client_state *csp, char **header) { - int block_header = (((csp->action->flags & ACTION_HIDE_FORWARDED) != 0) - || ((csp->action->flags & ACTION_CHANGE_X_FORWARDED_FOR) && - (0 == strcmpic(csp->action->string[ACTION_STRING_CHANGE_X_FORWARDED_FOR], "block")))); - - if (block_header) - { - freez(*header); - log_error(LOG_LEVEL_HEADER, "crunched x-forwarded-for!"); - } - else if (0 == strcmpic(csp->action->string[ACTION_STRING_CHANGE_X_FORWARDED_FOR], "add")) + if (0 != (csp->action->flags & ACTION_CHANGE_X_FORWARDED_FOR)) { - /* Save it so we can re-add it later */ - freez(csp->x_forwarded_for); - csp->x_forwarded_for = *header; + const char *param = csp->action->string[ACTION_STRING_CHANGE_X_FORWARDED_FOR]; - /* - * Always set *header = NULL, since this information - * will be sent at the end of the header. - */ - *header = NULL; + if (0 == strcmpic(param, "block")) + { + freez(*header); + log_error(LOG_LEVEL_HEADER, "crunched x-forwarded-for!"); + } + else if (0 == strcmpic(param, "add")) + { + /* Save it so we can re-add it later */ + freez(csp->x_forwarded_for); + csp->x_forwarded_for = *header; + + /* + * Always set *header = NULL, since this information + * will be sent at the end of the header. + */ + *header = NULL; + } } return JB_ERR_OK; diff --git a/project.h b/project.h index 8bf30209..026fc0f0 100644 --- a/project.h +++ b/project.h @@ -1,7 +1,7 @@ #ifndef PROJECT_H_INCLUDED #define PROJECT_H_INCLUDED /** Version string. */ -#define PROJECT_H_VERSION "$Id: project.h,v 1.117 2008/08/30 12:03:07 fabiankeil Exp $" +#define PROJECT_H_VERSION "$Id: project.h,v 1.118 2008/09/19 15:26:29 fabiankeil Exp $" /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/project.h,v $ @@ -37,6 +37,11 @@ * * Revisions : * $Log: project.h,v $ + * Revision 1.118 2008/09/19 15:26:29 fabiankeil + * Add change-x-forwarded-for{} action to block or add + * X-Forwarded-For headers. Mostly based on code removed + * before 3.0.7. + * * Revision 1.117 2008/08/30 12:03:07 fabiankeil * Remove FEATURE_COOKIE_JAR. * @@ -1062,8 +1067,8 @@ struct iob #define ACTION_DOWNGRADE 0x00000004UL /** Action bitmap: Fast redirects. */ #define ACTION_FAST_REDIRECTS 0x00000008UL -/** Action bitmap: Remove existing "Forwarded" header, and do not add another. */ -#define ACTION_HIDE_FORWARDED 0x00000010UL +/** Action bitmap: Remove or add "X-Forwarded-For" header. */ +#define ACTION_CHANGE_X_FORWARDED_FOR 0x00000010UL /** Action bitmap: Hide "From" header. */ #define ACTION_HIDE_FROM 0x00000020UL /** Action bitmap: Hide "Referer" header. (sic - follow HTTP, not English). */ @@ -1108,8 +1113,6 @@ struct iob #define ACTION_OVERWRITE_LAST_MODIFIED 0x02000000UL /** Action bitmap: Replace or block Accept-Language header */ #define ACTION_HIDE_ACCEPT_LANGUAGE 0x04000000UL -/** Action bitmap: Remove or add "X-Forwarded-For" header. */ -#define ACTION_CHANGE_X_FORWARDED_FOR 0x08000000UL /** Action string index: How to deanimate GIFs */ diff --git a/regression-tests.action b/regression-tests.action index 46ecc463..ee3a821b 100644 --- a/regression-tests.action +++ b/regression-tests.action @@ -1,5 +1,5 @@ ############################################################################# -# $Id: regression-tests.action,v 1.15 2008/08/14 18:33:37 fabiankeil Exp $ +# $Id: regression-tests.action,v 1.16 2008/09/19 15:31:38 fabiankeil Exp $ ############################################################################# # # This is a configuration file for Privoxy-Regression-Test @@ -315,29 +315,19 @@ TAG:^crunch-outgoing-cookies$ TAG:^session-cookies-only$ ####################################################### -# Test hide-forwarded-for-headers +# Test change-x-forwarded-for ####################################################### -# Set Header = X-Forwarded-For: 10.0.0.1 -# Expect Header = REMOVAL -{\ - +hide-forwarded-for-headers \ - -change-x-forwarded-for \ -} -TAG:^hide-forwarded-for-headers$ - # Set Header = X-Forwarded-For: 10.0.0.1 # Expect Header = NO CHANGE {\ - -hide-forwarded-for-headers \ -change-x-forwarded-for \ } -TAG:^-hide-forwarded-for-headers$ +TAG:^-change-x-forwarded-for$ # Set Header = X-Forwarded-For: 10.0.0.1 # Expect Header = REMOVAL {\ - -hide-forwarded-for-headers \ +change-x-forwarded-for{block} \ } TAG:^change-x-forwarded-for\{block\}$ @@ -345,7 +335,6 @@ TAG:^change-x-forwarded-for\{block\}$ # Set Header = X-Forwarded-For: 10.0.0.1 # Expect Header = SOME CHANGE {\ - -hide-forwarded-for-headers \ +change-x-forwarded-for{add} \ } TAG:^change-x-forwarded-for\{add\}$ diff --git a/templates/edit-actions-for-url b/templates/edit-actions-for-url index 2c9f470d..3c11ade8 100644 --- a/templates/edit-actions-for-url +++ b/templates/edit-actions-for-url @@ -32,6 +32,11 @@ # # Revisions : # $Log: edit-actions-for-url,v $ +# Revision 1.55 2008/09/19 15:26:29 fabiankeil +# Add change-x-forwarded-for{} action to block or add +# X-Forwarded-For headers. Mostly based on code removed +# before 3.0.7. +# # Revision 1.54 2008/03/29 12:14:27 fabiankeil # Remove send-wafer and send-vanilla-wafer actions. # @@ -982,20 +987,6 @@ function show_limit_connect_opts(tf) value="@hide-content-disposition-param@">
- - - - - - hide-forwarded-for-headers - Remove any existing X-Forwarded-for header. -