list entries in outgoing cookie monitor one per line

for easier readability.
For this adjust outgoingCookies entry to use Cookie[] instead of String[]
pull/97/head
reger 8 years ago
parent f37a86e1c6
commit b32bcdf344

@ -12,8 +12,8 @@
<p>Showing #[num]# entries from a total of #[total]# Cookies.</p> <p>Showing #[num]# entries from a total of #[total]# Cookies.</p>
<table border="0"> <table border="0">
<colgroup> <colgroup>
<col width="10" span="3" /> <col width="10%" span="3" />
<col width="70" /> <col width="70%" />
</colgroup> </colgroup>
<tr class="TableHeader"> <tr class="TableHeader">
<td>Receiving Host</td> <td>Receiving Host</td>

@ -30,6 +30,7 @@
import java.util.Date; import java.util.Date;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import javax.servlet.http.Cookie;
import net.yacy.cora.protocol.HeaderFramework; import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader; import net.yacy.cora.protocol.RequestHeader;
@ -65,17 +66,17 @@ public class CookieMonitorOutgoing_p {
final Iterator<Map.Entry<String, Object[]>> i = switchboard.outgoingCookies.entrySet().iterator(); final Iterator<Map.Entry<String, Object[]>> i = switchboard.outgoingCookies.entrySet().iterator();
Map.Entry<String, Object[]> entry; Map.Entry<String, Object[]> entry;
String host, client; String host, client;
Object[] cookies; Cookie[] cookies;
Date date; Date date;
Object[] oa; Object[] oa;
while ((entCount < maxCount) && (i.hasNext())) { while ((entCount < maxCount) && (i.hasNext())) {
// get out values // get out values
entry = i.next(); entry = i.next();
host = entry.getKey(); host = entry.getKey();
oa = entry.getValue(); oa = entry.getValue(); // entry structure -> { date, client, Cookie[] }
date = (Date) oa[0]; date = (Date) oa[0];
client = (String) oa[1]; client = (String) oa[1];
cookies = (Object[]) oa[2]; cookies = (Cookie[]) oa[2];
// put values in template // put values in template
prop.put("list_" + entCount + "_dark", dark ? "1" : "0" ); 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 + "_date", HeaderFramework.formatRFC1123(date));
prop.put("list_" + entCount + "_client", client); prop.put("list_" + entCount + "_client", client);
while (tmpCount < cookies.length){ 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++; tmpCount++;
} }
prop.put("list_" + entCount + "_cookies", tmpCount); prop.put("list_" + entCount + "_cookies", tmpCount);

@ -221,7 +221,7 @@ public final class HTTPDProxyHandler {
*/ */
if (sb.getConfigBool("proxy.monitorCookies", false)) { if (sb.getConfigBool("proxy.monitorCookies", false)) {
if (requestHeader.containsKey(RequestHeader.COOKIE)) { 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) { synchronized(sb.outgoingCookies) {
sb.outgoingCookies.put(targethost, entry); sb.outgoingCookies.put(targethost, entry);
} }

Loading…
Cancel
Save