Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dbdad998 authored by Grace Kloba's avatar Grace Kloba
Browse files

Fix a cookie bug. If "secure" is in the end of the string, it was ignored.

parent 0cd48879
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -833,22 +833,24 @@ public final class CookieManager {

                // "secure" is a known attribute doesn't use "=";
                // while sites like live.com uses "secure="
                if (length - index > SECURE_LENGTH
                if (length - index >= SECURE_LENGTH
                        && cookieString.substring(index, index + SECURE_LENGTH).
                        equalsIgnoreCase(SECURE)) {
                    index += SECURE_LENGTH;
                    cookie.secure = true;
                    if (index == length) break;
                    if (cookieString.charAt(index) == EQUAL) index++;
                    continue;
                }

                // "httponly" is a known attribute doesn't use "=";
                // while sites like live.com uses "httponly="
                if (length - index > HTTP_ONLY_LENGTH
                if (length - index >= HTTP_ONLY_LENGTH
                        && cookieString.substring(index,
                            index + HTTP_ONLY_LENGTH).
                        equalsIgnoreCase(HTTP_ONLY)) {
                    index += HTTP_ONLY_LENGTH;
                    if (index == length) break;
                    if (cookieString.charAt(index) == EQUAL) index++;
                    // FIXME: currently only parse the attribute
                    continue;