Workaround for space in cookie name
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1571 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
5791ce19c3
commit
405dad0eef
|
@ -29,12 +29,20 @@ public class DavMailCookieSpec extends RFC2109Spec {
|
||||||
@Override
|
@Override
|
||||||
public void validate(String host, int port, String path,
|
public void validate(String host, int port, String path,
|
||||||
boolean secure, final Cookie cookie) throws MalformedCookieException {
|
boolean secure, final Cookie cookie) throws MalformedCookieException {
|
||||||
|
// workaround for space in cookie name
|
||||||
String cookieName = cookie.getName();
|
String cookieName = cookie.getName();
|
||||||
if (cookieName != null && cookieName.indexOf(' ') >= 0) {
|
if (cookieName != null && cookieName.indexOf(' ') >= 0) {
|
||||||
cookie.setName(cookieName.replaceAll(" ", ""));
|
cookie.setName(cookieName.replaceAll(" ", ""));
|
||||||
} else {
|
} else {
|
||||||
cookieName = null;
|
cookieName = null;
|
||||||
}
|
}
|
||||||
|
// workaround for invalid cookie path
|
||||||
|
String cookiePath = cookie.getPath();
|
||||||
|
if (cookiePath != null && !path.startsWith(cookiePath)) {
|
||||||
|
cookie.setPath(path);
|
||||||
|
} else {
|
||||||
|
cookiePath = null;
|
||||||
|
}
|
||||||
String hostWithoutDomain = host.substring(0, host.length()
|
String hostWithoutDomain = host.substring(0, host.length()
|
||||||
- cookie.getDomain().length());
|
- cookie.getDomain().length());
|
||||||
int dotIndex = hostWithoutDomain.indexOf('.');
|
int dotIndex = hostWithoutDomain.indexOf('.');
|
||||||
|
@ -47,5 +55,8 @@ public class DavMailCookieSpec extends RFC2109Spec {
|
||||||
if (cookieName != null) {
|
if (cookieName != null) {
|
||||||
cookie.setName(cookieName);
|
cookie.setName(cookieName);
|
||||||
}
|
}
|
||||||
|
if (cookiePath != null) {
|
||||||
|
cookie.setPath(cookiePath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue