mirror of
https://github.com/moparisthebest/davmail
synced 2025-01-12 14:08:38 -05:00
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
|
||||
public void validate(String host, int port, String path,
|
||||
boolean secure, final Cookie cookie) throws MalformedCookieException {
|
||||
// workaround for space in cookie name
|
||||
String cookieName = cookie.getName();
|
||||
if (cookieName != null && cookieName.indexOf(' ') >= 0) {
|
||||
cookie.setName(cookieName.replaceAll(" ", ""));
|
||||
} else {
|
||||
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()
|
||||
- cookie.getDomain().length());
|
||||
int dotIndex = hostWithoutDomain.indexOf('.');
|
||||
@ -47,5 +55,8 @@ public class DavMailCookieSpec extends RFC2109Spec {
|
||||
if (cookieName != null) {
|
||||
cookie.setName(cookieName);
|
||||
}
|
||||
if (cookiePath != null) {
|
||||
cookie.setPath(cookiePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user