I wrote a program that shows all the headerfield and values of a webpage. I try to match all cookies found from setcookie headerfield with firefox page info.(I add an extension of view cookie) . firefox shows more name value pairs than my own program
here is my code....
try
{
String line = null;
URL gmail = new URL("http://www.gmail.com/");
URLConnection connect = gmail.openConnection();
Map<String,List<String>>map=null;
map=connect.getHeaderFields();
java.util.Iterator it = map.keySet().iterator();
while(it.hasNext())
{
String co = (String)it.next();
System.out.println(co);
List<String>word = map.get(co);
java.util.Iterator ita = word.iterator();
while(ita.hasNext())
System.out.println(" "+(String)ita.next());
}
}
catch(Exception e)
{
System.out.println(e);
}
How these extra cookie comes?
Try using something like HTTPUnit instead of doing the connections yourself.
http://httpunit.sourceforge.net/
Javascript on the page could be connecting to the server, or even to other serves, and getting the cookies from there.