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(
|
||||
const std::string& policy_id) {
|
||||
const std::string& renewal_policy_id) {
|
||||
event_listener_.set_renewal_needed(false);
|
||||
CdmKeyRequest request;
|
||||
const CdmResponseType result =
|
||||
@@ -92,7 +92,7 @@ void LicenseHolder::GenerateAndPostRenewalRequest(
|
||||
if (config_.dump_golden_data()) {
|
||||
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));
|
||||
ASSERT_TRUE(request_in_flight_->is_connected())
|
||||
<< "Failed for " << content_id();
|
||||
@@ -117,7 +117,7 @@ void LicenseHolder::LoadRenewal() {
|
||||
}
|
||||
|
||||
void LicenseHolder::GenerateAndPostReleaseRequest(
|
||||
const std::string& policy_id) {
|
||||
const std::string& release_policy_id) {
|
||||
event_listener_.set_renewal_needed(false);
|
||||
CdmKeyRequest request;
|
||||
CdmAppParameterMap empty_app_parameters;
|
||||
@@ -134,7 +134,7 @@ void LicenseHolder::GenerateAndPostReleaseRequest(
|
||||
// TODO (b/295956275) vickymin: write DumpReleaseRequest function
|
||||
// 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));
|
||||
ASSERT_TRUE(request_in_flight_->is_connected())
|
||||
<< "Failed for " << content_id();
|
||||
@@ -262,22 +262,16 @@ void LicenseHolder::GenerateKeyRequest(const InitializationData& init_data,
|
||||
}
|
||||
|
||||
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
|
||||
// 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
|
||||
// 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.
|
||||
const std::string path = server_url + config_.client_auth();
|
||||
std::string video_query;
|
||||
if (!policy_id.empty()) {
|
||||
if (path.find("proxy.uat") != std::string::npos) {
|
||||
// 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 (!renewal_policy_id.empty()) {
|
||||
const std::string video_query =
|
||||
"video_id=" + content_id() + "&renewal_policy=" + renewal_policy_id;
|
||||
// If there is already a parameter, then we don't need to add another
|
||||
// question mark.
|
||||
return path + ((path.find('?') == std::string::npos) ? '?' : '&') +
|
||||
|
||||
@@ -69,13 +69,13 @@ class LicenseHolder {
|
||||
// Attempt to reload a license, but expect a failure.
|
||||
void FailReloadLicense();
|
||||
// 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.
|
||||
void FetchRenewal();
|
||||
// Load the renewal response that was fetched in FetchRenewal().
|
||||
void LoadRenewal();
|
||||
// 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.
|
||||
void 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
|
||||
// to this 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.
|
||||
void GetKeyResponse(const CdmKeyRequest& key_request);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user