Update request url
The test server for UAT and for the SDKs now accept the same url format for renewals. Bug: 328763985 Change-Id: I1a58412047735efa26da7986bf19fa9a7fbaf374
This commit is contained in:
committed by
Rahul Frias
parent
1c6ec56725
commit
1f3c38d6a3
@@ -83,7 +83,7 @@ void LicenseHolder::FailReloadLicense() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LicenseHolder::GenerateAndPostRenewalRequest(
|
void LicenseHolder::GenerateAndPostRenewalRequest(
|
||||||
const std::string& policy_id) {
|
const std::string& renewal_policy_id) {
|
||||||
event_listener_.set_renewal_needed(false);
|
event_listener_.set_renewal_needed(false);
|
||||||
CdmKeyRequest request;
|
CdmKeyRequest request;
|
||||||
const CdmResponseType result =
|
const CdmResponseType result =
|
||||||
@@ -92,7 +92,7 @@ void LicenseHolder::GenerateAndPostRenewalRequest(
|
|||||||
if (config_.dump_golden_data()) {
|
if (config_.dump_golden_data()) {
|
||||||
MessageDumper::DumpRenewalRequest(request);
|
MessageDumper::DumpRenewalRequest(request);
|
||||||
}
|
}
|
||||||
const std::string url = MakeUrl(config_.renewal_server(), policy_id);
|
const std::string url = MakeUrl(config_.renewal_server(), renewal_policy_id);
|
||||||
request_in_flight_.reset(new UrlRequest(url));
|
request_in_flight_.reset(new UrlRequest(url));
|
||||||
ASSERT_TRUE(request_in_flight_->is_connected())
|
ASSERT_TRUE(request_in_flight_->is_connected())
|
||||||
<< "Failed for " << content_id();
|
<< "Failed for " << content_id();
|
||||||
@@ -117,7 +117,7 @@ void LicenseHolder::LoadRenewal() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LicenseHolder::GenerateAndPostReleaseRequest(
|
void LicenseHolder::GenerateAndPostReleaseRequest(
|
||||||
const std::string& policy_id) {
|
const std::string& release_policy_id) {
|
||||||
event_listener_.set_renewal_needed(false);
|
event_listener_.set_renewal_needed(false);
|
||||||
CdmKeyRequest request;
|
CdmKeyRequest request;
|
||||||
CdmAppParameterMap empty_app_parameters;
|
CdmAppParameterMap empty_app_parameters;
|
||||||
@@ -134,7 +134,7 @@ void LicenseHolder::GenerateAndPostReleaseRequest(
|
|||||||
// TODO (b/295956275) vickymin: write DumpReleaseRequest function
|
// TODO (b/295956275) vickymin: write DumpReleaseRequest function
|
||||||
// MessageDumper::DumpReleaseRequest(request);
|
// MessageDumper::DumpReleaseRequest(request);
|
||||||
}
|
}
|
||||||
const std::string url = MakeUrl(config_.renewal_server(), policy_id);
|
const std::string url = MakeUrl(config_.renewal_server(), release_policy_id);
|
||||||
request_in_flight_.reset(new UrlRequest(url));
|
request_in_flight_.reset(new UrlRequest(url));
|
||||||
ASSERT_TRUE(request_in_flight_->is_connected())
|
ASSERT_TRUE(request_in_flight_->is_connected())
|
||||||
<< "Failed for " << content_id();
|
<< "Failed for " << content_id();
|
||||||
@@ -262,22 +262,16 @@ void LicenseHolder::GenerateKeyRequest(const InitializationData& init_data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string LicenseHolder::MakeUrl(const std::string& server_url,
|
std::string LicenseHolder::MakeUrl(const std::string& server_url,
|
||||||
const std::string& policy_id) {
|
const std::string& renewal_policy_id) {
|
||||||
// For tests, we want to specify the policy, but the UAT server only allows us
|
// For tests, we want to specify the policy, but the UAT server only allows us
|
||||||
// to set the content id as the video_id. So each policy is matched to a
|
// to set the content id as the video_id. So each policy is matched to a
|
||||||
// single license with the same name. The local license server, on the other
|
// single license with the same name. The local license server, on the other
|
||||||
// hand, wants to see the policy id in the url. So we have to guess which
|
// hand, wants to see the policy id in the url. So we have to guess which
|
||||||
// format to use based on the name of the server.
|
// format to use based on the name of the server.
|
||||||
const std::string path = server_url + config_.client_auth();
|
const std::string path = server_url + config_.client_auth();
|
||||||
std::string video_query;
|
if (!renewal_policy_id.empty()) {
|
||||||
if (!policy_id.empty()) {
|
const std::string video_query =
|
||||||
if (path.find("proxy.uat") != std::string::npos) {
|
"video_id=" + content_id() + "&renewal_policy=" + renewal_policy_id;
|
||||||
// This is uat or uat-nightly. Set the video_id.
|
|
||||||
video_query = "video_id=" + policy_id;
|
|
||||||
} else {
|
|
||||||
// This is probably a local license server. Set the policy.
|
|
||||||
video_query = "policy=" + policy_id;
|
|
||||||
}
|
|
||||||
// If there is already a parameter, then we don't need to add another
|
// If there is already a parameter, then we don't need to add another
|
||||||
// question mark.
|
// question mark.
|
||||||
return path + ((path.find('?') == std::string::npos) ? '?' : '&') +
|
return path + ((path.find('?') == std::string::npos) ? '?' : '&') +
|
||||||
|
|||||||
@@ -69,13 +69,13 @@ class LicenseHolder {
|
|||||||
// Attempt to reload a license, but expect a failure.
|
// Attempt to reload a license, but expect a failure.
|
||||||
void FailReloadLicense();
|
void FailReloadLicense();
|
||||||
// Generate the renewal request, and send it to the server.
|
// Generate the renewal request, and send it to the server.
|
||||||
void GenerateAndPostRenewalRequest(const std::string& policy_id);
|
void GenerateAndPostRenewalRequest(const std::string& renewal_policy_id);
|
||||||
// Fetch the renewal response. This can add a few seconds of latency.
|
// Fetch the renewal response. This can add a few seconds of latency.
|
||||||
void FetchRenewal();
|
void FetchRenewal();
|
||||||
// Load the renewal response that was fetched in FetchRenewal().
|
// Load the renewal response that was fetched in FetchRenewal().
|
||||||
void LoadRenewal();
|
void LoadRenewal();
|
||||||
// Generate the release request, and send it to the server.
|
// Generate the release request, and send it to the server.
|
||||||
void GenerateAndPostReleaseRequest(const std::string& policy_id);
|
void GenerateAndPostReleaseRequest(const std::string& release_policy_id);
|
||||||
// Fetch the release response. This can add a few seconds of latency.
|
// Fetch the release response. This can add a few seconds of latency.
|
||||||
void FetchRelease();
|
void FetchRelease();
|
||||||
// Load the release response that was fetched in FetchRelease().
|
// Load the release response that was fetched in FetchRelease().
|
||||||
@@ -137,7 +137,7 @@ class LicenseHolder {
|
|||||||
// Generate a URL for the specified policy. The license request should be sent
|
// Generate a URL for the specified policy. The license request should be sent
|
||||||
// to this url.
|
// to this url.
|
||||||
std::string MakeUrl(const std::string& server_url,
|
std::string MakeUrl(const std::string& server_url,
|
||||||
const std::string& policy_id);
|
const std::string& renewal_policy_id);
|
||||||
// Fetch the key response from the server.
|
// Fetch the key response from the server.
|
||||||
void GetKeyResponse(const CdmKeyRequest& key_request);
|
void GetKeyResponse(const CdmKeyRequest& key_request);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user