- @jroper's fix did not work, so I just fixed it again.
Conflicts:

	src/main/java/org/jboss/netty/handler/codec/http/DefaultCookie.java
This commit is contained in:
Trustin Lee 2012-06-02 23:05:20 -07:00
parent e13ff4ae93
commit 38314b5191
3 changed files with 38 additions and 24 deletions

View File

@ -113,7 +113,6 @@ public class CookieDecoder {
}
Cookie c = new DefaultCookie(name, value);
cookies.add(c);
boolean discard = false;
boolean secure = false;
@ -189,6 +188,8 @@ public class CookieDecoder {
c.setPorts(ports);
c.setDiscard(discard);
}
cookies.add(c);
}
return cookies;

View File

@ -247,22 +247,24 @@ public class DefaultCookie implements Cookie {
return false;
}
if (getPath() == null && that.getPath() != null) {
if (getPath() == null) {
if (that.getPath() != null) {
return false;
}
} else if (that.getPath() == null) {
return false;
} else if (that.getPath() == null && getPath() != null) {
return false;
}
if (!getPath().equals(that.getPath())) {
} else if (!getPath().equals(that.getPath())) {
return false;
}
if (getDomain() == null && that.getDomain() != null) {
return false;
} else if (that.getDomain() == null && getDomain() != null) {
return false;
}
if (!getDomain().equalsIgnoreCase(that.getDomain())) {
if (getDomain() == null) {
if (that.getDomain() != null) {
return false;
}
} else if (that.getDomain() == null) {
return false;
} else {
return getDomain().equalsIgnoreCase(that.getDomain());
}
return true;
@ -275,23 +277,31 @@ public class DefaultCookie implements Cookie {
return v;
}
if (getPath() == null && c.getPath() != null) {
return -1;
} else if (c.getPath() == null && getPath() != null) {
if (getPath() == null) {
if (c.getPath() != null) {
return -1;
}
} else if (c.getPath() == null) {
return 1;
} else {
v = getPath().compareTo(c.getPath());
if (v != 0) {
return v;
}
}
v = getPath().compareTo(c.getPath());
if (v != 0) {
if (getDomain() == null) {
if (c.getDomain() != null) {
return -1;
}
} else if (c.getDomain() == null) {
return 1;
} else {
v = getDomain().compareToIgnoreCase(c.getDomain());
return v;
}
if (getDomain() == null && c.getDomain() != null) {
return -1;
} else if (c.getDomain() == null && getDomain() != null) {
return 1;
}
v = getDomain().compareToIgnoreCase(c.getDomain());
return v;
return 0;
}
@Override
@ -346,3 +356,4 @@ public class DefaultCookie implements Cookie {
return value;
}
}

View File

@ -233,6 +233,7 @@ public class CookieDecoderTest {
Iterator<Cookie> it = cookies.iterator();
Cookie c;
assertTrue(it.hasNext());
c = it.next();
assertEquals(1, c.getVersion());
assertEquals("session_id", c.getName());
@ -244,6 +245,7 @@ public class CookieDecoderTest {
assertTrue(c.getPorts().isEmpty());
assertEquals(-1, c.getMaxAge());
assertTrue(it.hasNext());
c = it.next();
assertEquals(1, c.getVersion());
assertEquals("session_id", c.getName());