Skip to content

Commit

Permalink
Fix: #3769 - Handle all 2XX status codes on license request (#3770)
Browse files Browse the repository at this point in the history
* Update onload response status

* Fix failing license response on 2xx HTTP codes

Co-authored-by: Pavel Zablockij <[email protected]>
  • Loading branch information
Pavelas and Pavel Zablockij authored Sep 10, 2021
1 parent 7724971 commit 7a397c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/streaming/protection/controllers/ProtectionController.js
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ function ProtectionController(config) {
return;
}

if (xhr.status === 200) {
if (xhr.status >= 200 && xhr.status <= 299) {
let licenseResponse = new LicenseResponse(xhr.responseURL, Utils.parseHttpHeaders(xhr.getAllResponseHeaders ? xhr.getAllResponseHeaders() : null), xhr.response);
applyFilters(licenseResponseFilters, licenseResponse).then(() => {
const licenseMessage = licenseServerData.getLicenseMessage(licenseResponse.data, keySystemString, messageType);
Expand Down Expand Up @@ -846,7 +846,7 @@ function ProtectionController(config) {
};

xhr.onload = function () {
if (this.status === 200 || retriesCount <= 0) {
if (this.status >= 200 && this.status <= 299 || retriesCount <= 0) {
onLoad(this);
} else {
logger.warn('License request failed (' + this.status + '). Retrying it... Pending retries: ' + retriesCount);
Expand Down

0 comments on commit 7a397c9

Please sign in to comment.