* add config option to disable cookie monitoring (disabled by default)

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5028 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
f1ori 17 years ago
parent f0dfb858d8
commit b0724e5ec0

@ -639,6 +639,9 @@ proxy.sendViaHeader=true
# Specifies if the proxy should send the X-Forwarded-For header
proxy.sendXForwardedForHeader=true
# Enable cookie monitoring
proxy.monitorCookies=false
# msgForwarding: Specifies if yacy should forward received messages via
# email to the configured email address
msgForwardingEnabled=false

@ -26,6 +26,12 @@
</tr>
#{/list}#
</table>
<form action="" method="post" >
<fieldset>
#(monitorCookies.off)#::<input type="submit" name="enableCookieMonitoring" value="Enable Cookie Monitoring"/>#(/monitorCookies.off)#
#(monitorCookies.on)#::<input type="submit" name="disableCookieMonitoring" value="Disable Cookie Monitoring"/>#(/monitorCookies.on)#
</fieldset>
</form>
#%env/templates/footer.template%#
</body>
</html>

@ -42,6 +42,19 @@ public class CookieMonitorIncoming_p {
// return variable that accumulates replacements
serverObjects prop = new serverObjects();
// handle on/off button
if(post != null) {
if(post.containsKey("enableCookieMonitoring")) {
switchboard.setConfig("proxy.monitorCookies", true);
} else if (post.containsKey("disableCookieMonitoring")) {
switchboard.setConfig("proxy.monitorCookies", false);
switchboard.incomingCookies.clear();
switchboard.outgoingCookies.clear();
}
}
prop.put("monitorCookies.on", switchboard.getConfigBool("proxy.monitorCookies", false) ? "1":"0");
prop.put("monitorCookies.off", !switchboard.getConfigBool("proxy.monitorCookies", false) ? "1":"0");
int maxCount = 100;
int entCount = 0;
int tmpCount = 0;
@ -80,6 +93,7 @@ public class CookieMonitorIncoming_p {
prop.put("list", entCount);
prop.put("num", entCount);
prop.put("total", switchboard.incomingCookies.size());
// return rewrite properties
return prop;
}

@ -30,6 +30,12 @@
</tr>
#{/list}#
</table>
<form action="" method="post" >
<fieldset>
#(monitorCookies.off)#::<input type="submit" name="enableCookieMonitoring" value="Enable Cookie Monitoring"/>#(/monitorCookies.off)#
#(monitorCookies.on)#::<input type="submit" name="disableCookieMonitoring" value="Disable Cookie Monitoring"/>#(/monitorCookies.on)#
</fieldset>
</form>
#%env/templates/footer.template%#
</body>
</html>

@ -42,6 +42,19 @@ public class CookieMonitorOutgoing_p {
// return variable that accumulates replacements
serverObjects prop = new serverObjects();
// handle on/off button
if(post != null) {
if(post.containsKey("enableCookieMonitoring")) {
switchboard.setConfig("proxy.monitorCookies", true);
} else if (post.containsKey("disableCookieMonitoring")) {
switchboard.setConfig("proxy.monitorCookies", false);
switchboard.incomingCookies.clear();
switchboard.outgoingCookies.clear();
}
}
prop.put("monitorCookies.on", switchboard.getConfigBool("proxy.monitorCookies", false) ? "1":"0");
prop.put("monitorCookies.off", !switchboard.getConfigBool("proxy.monitorCookies", false) ? "1":"0");
int maxCount = 100;
int entCount = 0;
int tmpCount = 0;

@ -240,10 +240,12 @@ public final class httpdProxyHandler {
path = "$Path" "=" value
domain = "$Domain" "=" value
*/
if (requestHeader.containsKey(httpHeader.COOKIE)) {
Object[] entry = new Object[]{new Date(), clienthost, requestHeader.getMultiple(httpHeader.COOKIE)};
synchronized(switchboard.outgoingCookies) {
switchboard.outgoingCookies.put(targethost, entry);
if (switchboard.getConfigBool("proxy.monitorCookies", false)) {
if (requestHeader.containsKey(httpHeader.COOKIE)) {
Object[] entry = new Object[]{new Date(), clienthost, requestHeader.getMultiple(httpHeader.COOKIE)};
synchronized(switchboard.outgoingCookies) {
switchboard.outgoingCookies.put(targethost, entry);
}
}
}
}
@ -264,10 +266,12 @@ public final class httpdProxyHandler {
| "Secure"
| "Version" "=" 1*DIGIT
*/
if (respondHeader.containsKey(httpHeader.SET_COOKIE)) {
Object[] entry = new Object[]{new Date(), targetclient, respondHeader.getMultiple(httpHeader.SET_COOKIE)};
synchronized(switchboard.incomingCookies) {
switchboard.incomingCookies.put(serverhost, entry);
if (switchboard.getConfigBool("proxy.monitorCookies", false)) {
if (respondHeader.containsKey(httpHeader.SET_COOKIE)) {
Object[] entry = new Object[]{new Date(), targetclient, respondHeader.getMultiple(httpHeader.SET_COOKIE)};
synchronized(switchboard.incomingCookies) {
switchboard.incomingCookies.put(serverhost, entry);
}
}
}
}

Loading…
Cancel
Save