// all the headers, looking for cookies
String headerName = this.connection.getHeaderFieldKey(0);
String headerValue = this.connection.getHeaderField(0);
Vector cookieVector = new Vector();
CookieSpec cookieSpec = CookiePolicy.getDefaultSpec();
for (int i = 1; (headerName != null) || (headerValue != null); i++)
{
LOGGER.debug("Header name = [" + headerName + "]");
LOGGER.debug("Header value = [" + headerValue + "]");
if ((headerName != null)
&& (headerName.toLowerCase().equals("set-cookie")
|| headerName.toLowerCase().equals("set-cookie2")))
{
// Parse the cookie definition
org.apache.commons.httpclient.Cookie[] cookies;
try
{
cookies = cookieSpec.parse(
CookieUtil.getCookieDomain(getWebRequest(),
getConnection().getURL().getHost()),
CookieUtil.getCookiePort(getWebRequest(),
getConnection().getURL().getPort()),
CookieUtil.getCookiePath(getWebRequest(),