From b32bcdf344082186badfee94bb70435eb5360be4 Mon Sep 17 00:00:00 2001 From: reger Date: Sat, 10 Dec 2016 22:08:09 +0100 Subject: [PATCH] list entries in outgoing cookie monitor one per line for easier readability. For this adjust outgoingCookies entry to use Cookie[] instead of String[] --- htroot/CookieMonitorOutgoing_p.html | 4 ++-- htroot/CookieMonitorOutgoing_p.java | 9 +++++---- source/net/yacy/server/http/HTTPDProxyHandler.java | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/htroot/CookieMonitorOutgoing_p.html b/htroot/CookieMonitorOutgoing_p.html index d5dba4edb..ebcd5576f 100644 --- a/htroot/CookieMonitorOutgoing_p.html +++ b/htroot/CookieMonitorOutgoing_p.html @@ -12,8 +12,8 @@

Showing #[num]# entries from a total of #[total]# Cookies.

- - + + diff --git a/htroot/CookieMonitorOutgoing_p.java b/htroot/CookieMonitorOutgoing_p.java index 274d708cf..23f77e217 100644 --- a/htroot/CookieMonitorOutgoing_p.java +++ b/htroot/CookieMonitorOutgoing_p.java @@ -30,6 +30,7 @@ import java.util.Date; import java.util.Iterator; import java.util.Map; +import javax.servlet.http.Cookie; import net.yacy.cora.protocol.HeaderFramework; import net.yacy.cora.protocol.RequestHeader; @@ -65,17 +66,17 @@ public class CookieMonitorOutgoing_p { final Iterator> i = switchboard.outgoingCookies.entrySet().iterator(); Map.Entry entry; String host, client; - Object[] cookies; + Cookie[] cookies; Date date; Object[] oa; while ((entCount < maxCount) && (i.hasNext())) { // get out values entry = i.next(); host = entry.getKey(); - oa = entry.getValue(); + oa = entry.getValue(); // entry structure -> { date, client, Cookie[] } date = (Date) oa[0]; client = (String) oa[1]; - cookies = (Object[]) oa[2]; + cookies = (Cookie[]) oa[2]; // put values in template prop.put("list_" + entCount + "_dark", dark ? "1" : "0" ); @@ -84,7 +85,7 @@ public class CookieMonitorOutgoing_p { prop.put("list_" + entCount + "_date", HeaderFramework.formatRFC1123(date)); prop.put("list_" + entCount + "_client", client); while (tmpCount < cookies.length){ - prop.putHTML("list_" + entCount + "_cookies_" + tmpCount + "_item", ((String) cookies[tmpCount])); + prop.putHTML("list_" + entCount + "_cookies_" + tmpCount + "_item", cookies[tmpCount].getName() + "=" + cookies[tmpCount].getValue()); tmpCount++; } prop.put("list_" + entCount + "_cookies", tmpCount); diff --git a/source/net/yacy/server/http/HTTPDProxyHandler.java b/source/net/yacy/server/http/HTTPDProxyHandler.java index ff28602a5..10d3b931b 100644 --- a/source/net/yacy/server/http/HTTPDProxyHandler.java +++ b/source/net/yacy/server/http/HTTPDProxyHandler.java @@ -221,7 +221,7 @@ public final class HTTPDProxyHandler { */ if (sb.getConfigBool("proxy.monitorCookies", false)) { if (requestHeader.containsKey(RequestHeader.COOKIE)) { - final Object[] entry = new Object[]{new Date(), clienthost, requestHeader.getMultiple(RequestHeader.COOKIE)}; + final Object[] entry = new Object[]{new Date(), clienthost, requestHeader.getCookies()}; synchronized(sb.outgoingCookies) { sb.outgoingCookies.put(targethost, entry); }
Receiving Host