Exposes the Expires attribute on Android to flutter apps, aligning with iOS.
The HttpCookie class in Android (java.net sdk) has awkward Expires handling. It translates Expires into Max-Age by first converting it into a seconds offset from the current system time as described here: https://www.mit.edu/afs.new/sipb/project/android/docs/reference/java/net/HttpCookie.html. And as a consequence Expires is not available from an accessor, it must be calculated from the Max-Age attribute by performing the reverse translation. This patch performs that translation to ensure we carry over the remaining the duration between cookie gets and sets, aswell as to align with iOS which does expose Expires.
It should be noted that Expires is a deprecated attributed, in favor of the newer Max-Age attribute. However due to the nature of how this is handled on Android, namely that max-age is not readjusted and thus cannot be used reliably between getting and setting of cookies, we should use Expires to ensure cookies expire properly.
Exposes the
Expires
attribute on Android to flutter apps, aligning with iOS.The HttpCookie class in Android (java.net sdk) has awkward
Expires
handling. It translatesExpires
intoMax-Age
by first converting it into a seconds offset from the current system time as described here: https://www.mit.edu/afs.new/sipb/project/android/docs/reference/java/net/HttpCookie.html. And as a consequenceExpires
is not available from an accessor, it must be calculated from theMax-Age
attribute by performing the reverse translation. This patch performs that translation to ensure we carry over the remaining the duration between cookie gets and sets, aswell as to align with iOS which does exposeExpires
.It should be noted that
Expires
is a deprecated attributed, in favor of the newerMax-Age
attribute. However due to the nature of how this is handled on Android, namely that max-age is not readjusted and thus cannot be used reliably between getting and setting of cookies, we should useExpires
to ensure cookies expire properly.