been obsoleted by change-x-forwarded-for{block}.
*
* 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
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")
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)
-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 $
*
* 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.
*
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 */
-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 $
*
* 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.
*********************************************************************/
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;
#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 $
*
* 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.
*
#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). */
#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 */
#############################################################################
-# $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
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\}$
# 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\}$
#
# 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.
#
value="@hide-content-disposition-param@"><br>
</td>
</tr>
-
- <tr class="bg1" align="left" valign="top">
- <td class="en1" align="center" valign="middle"><input type="radio"
- name="hide_forwarded_for_headers" value="Y" @hide-forwarded-for-headers-y@
- ></td>
- <td class="dis1" align="center" valign="middle"><input type="radio"
- name="hide_forwarded_for_headers" value="N" @hide-forwarded-for-headers-n@
- ></td>
- <td class="noc1" align="center" valign="middle"><input type="radio"
- name="hide_forwarded_for_headers" value="X" @hide-forwarded-for-headers-x@
- ></td>
- <td class="action"><a href="@user-manual@@actions-help-prefix@HIDE-FORWARDED-FOR-HEADERS">hide-forwarded-for-headers</a></td>
- <td>Remove any existing X-Forwarded-for header.</td>
- </tr>
<tr class="bg1" align="left" valign="top">
<td class="en1" align="center" valign="middle"><input type="radio"
name="hide_from_header" id="hide_from_header_y" value="Y" @hide-from-header-y@