| Index: components/cronet/android/cronet_url_request_context_adapter.cc
|
| diff --git a/components/cronet/android/cronet_url_request_context_adapter.cc b/components/cronet/android/cronet_url_request_context_adapter.cc
|
| index 37a18cefb5069d6d39141a0d0273914781c85816..7f3b4c8f4c120ef460fa2d9dfc6e89309a8b5245 100644
|
| --- a/components/cronet/android/cronet_url_request_context_adapter.cc
|
| +++ b/components/cronet/android/cronet_url_request_context_adapter.cc
|
| @@ -372,6 +372,30 @@ void CronetURLRequestContextAdapter::InitializeOnNetworkThread(
|
| }
|
| }
|
|
|
| + // Iterate through HPKP configuration for every host.
|
| + for (auto hpkp_itr = config->hpkp_list.begin();
|
| + hpkp_itr != config->hpkp_list.end(); ++hpkp_itr) {
|
| + const URLRequestContextConfig::Hpkp& hpkp = **hpkp_itr;
|
| +
|
| + // Convert the vector of hash strings from the config to
|
| + // a vector of HashValue objects.
|
| + net::HashValueVector hash_value_vector;
|
| + for (const auto& hash : hpkp.pin_hashes) {
|
| + auto hash_value = net::HashValue(net::HASH_VALUE_SHA256);
|
| + bool good_hash = hash_value.FromString(*hash);
|
| + if (good_hash) {
|
| + hash_value_vector.push_back(hash_value);
|
| + } else {
|
| + LOG(WARNING) << "Unable to add hash value " << *hash;
|
| + }
|
| + }
|
| +
|
| + // Add the host pinning.
|
| + context_->transport_security_state()->AddHPKP(hpkp.host, base::Time::Max(),
|
| + hpkp.include_subdomains,
|
| + hash_value_vector, GURL());
|
| + }
|
| +
|
| JNIEnv* env = base::android::AttachCurrentThread();
|
| jcronet_url_request_context_.Reset(env, jcronet_url_request_context.obj());
|
| Java_CronetUrlRequestContext_initNetworkThread(
|
|
|