SheaSmith / atv.js

A JavaScript framework designed to simplify and accelerate the development of apps for the Apple TV 3
0 stars 0 forks source link

Certain Unicode characters result in an empty XHR request body #2

Open SheaSmith opened 2 years ago

SheaSmith commented 2 years ago

When attempting to use certain unicode characters in the request body of a XHR, the XHR sends an empty string instead. This is particularly problematic for retrieving FairPlay keys, as some providers may require raw binary strings, rather than the default Base64 supplied.

Example code:

var keyRequest = new XMLHttpRequest();
keyRequest.open("POST", "url");
keyRequest.send(<binary data>);
SheaSmith commented 2 years ago

Can workaround as we can use a simple reverse proxy. Essentially we post the Base64 body to the server, which then decodes it to binary, forwards the request onto the original server and then returns the response to the Apple TV. Not ideal, but for something as lightweight and infrequently used (compatively speaking) as a DRM server, it should be fine.