[AltSvc] Save expiration as int64 string instead of double.
commitf3d3d3b0e9cbf0fc666ba48e23db2330c6c8d29e
authorbnc <bnc@chromium.org>
Thu, 13 Aug 2015 16:31:02 +0000 (13 09:31 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 13 Aug 2015 16:31:38 +0000 (13 16:31 +0000)
tree19a84fedd9a72e5f9753e47205e3445003c85714
parent97e4b8c47fb7c21054b9471ab24a2be65639ab5e
[AltSvc] Save expiration as int64 string instead of double.

Save alternative service expiration times as int64 in a string instead of
double in HttpServerPropertiesManager::SaveAlternativeServiceToServerPrefs(),
and load expiration time accordingly in
HttpServerPropertiesManager::ParseAlternativeServiceDict().  The reason is that
numeric_limits<int64>::max() can be serialized in JSON, whereas
numeric_limits<double>::max() cannot.  That is, this change allows
base::Time::Max() expiration times.  Note that JSON does not support int64, so
it has to be converted into a string.

This change might result in unexpected behavior on user installations where
alternative services were persisted to disk as double with earlier versions.
However, as https://crrev.com/1227063002 has not even made it to Beta yet,
this can be safely ignored.

BUG=516034

Review URL: https://codereview.chromium.org/1275663002

Cr-Commit-Position: refs/heads/master@{#343209}
net/http/http_server_properties_manager.cc
net/http/http_server_properties_manager.h
net/http/http_server_properties_manager_unittest.cc