summaryrefslogtreecommitdiffstats
path: root/net/http/http_response_info.cc
diff options
context:
space:
mode:
authorrsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-29 23:38:27 +0000
committerrsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-29 23:38:27 +0000
commit6d7d80e033e9b067aa6aea375760fb505318daa2 (patch)
tree2b96285fe85b83a2f5ca8237794787ea033ec876 /net/http/http_response_info.cc
parentd6783d5ac2cff814dcafa21c6b5d9f97faa9db0e (diff)
downloadchromium_src-6d7d80e033e9b067aa6aea375760fb505318daa2.zip
chromium_src-6d7d80e033e9b067aa6aea375760fb505318daa2.tar.gz
chromium_src-6d7d80e033e9b067aa6aea375760fb505318daa2.tar.bz2
Cache certificates as DER on all platforms.
With the exception of Windows, every other platform was already serializing as a DER chain. Update Windows to no longer serialize in a proprietary format - use DER on all platforms. BUG=118706 TEST=existing unit tests Review URL: https://chromiumcodereview.appspot.com/9808094 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129725 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_response_info.cc')
-rw-r--r--net/http/http_response_info.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/net/http/http_response_info.cc b/net/http/http_response_info.cc
index bacffc3..e3fcb69 100644
--- a/net/http/http_response_info.cc
+++ b/net/http/http_response_info.cc
@@ -18,6 +18,22 @@ using base::Time;
namespace net {
+namespace {
+
+X509Certificate::PickleType GetPickleTypeForVersion(int version) {
+ switch (version) {
+ case 1:
+ return X509Certificate::PICKLETYPE_SINGLE_CERTIFICATE;
+ case 2:
+ return X509Certificate::PICKLETYPE_CERTIFICATE_CHAIN_V2;
+ case 3:
+ default:
+ return X509Certificate::PICKLETYPE_CERTIFICATE_CHAIN_V3;
+ }
+}
+
+} // namespace
+
// These values can be bit-wise combined to form the flags field of the
// serialized HttpResponseInfo.
enum {
@@ -148,10 +164,7 @@ bool HttpResponseInfo::InitFromPickle(const Pickle& pickle,
// read ssl-info
if (flags & RESPONSE_INFO_HAS_CERT) {
- X509Certificate::PickleType type = (version == 1) ?
- X509Certificate::PICKLETYPE_SINGLE_CERTIFICATE :
- (version == 2) ? X509Certificate::PICKLETYPE_CERTIFICATE_CHAIN_OLD :
- X509Certificate::PICKLETYPE_CERTIFICATE_CHAIN;
+ X509Certificate::PickleType type = GetPickleTypeForVersion(version);
ssl_info.cert = X509Certificate::CreateFromPickle(pickle, &iter, type);
if (!ssl_info.cert)
return false;