Added CORS headers to HSS output, added HTTP OPTIONS support to HLS and HSS outputs.

This commit is contained in:
Thulinma 2015-07-28 20:23:06 +02:00
parent 8e4985801a
commit b7b2bb5f68
2 changed files with 23 additions and 0 deletions

View file

@ -151,6 +151,17 @@ namespace Mist {
return; return;
} //crossdomain.xml } //crossdomain.xml
if (H.method == "OPTIONS"){
H.Clean();
H.SetHeader("Content-Type", "application/octet-stream");
H.SetHeader("Cache-Control", "no-cache");
H.setCORSHeaders();
H.SetBody("");
H.SendResponse("200", "OK", myConn);
H.Clean();
return;
}
if (H.url.find("hls") == std::string::npos){ if (H.url.find("hls") == std::string::npos){
myConn.close(); myConn.close();
return; return;

View file

@ -281,6 +281,7 @@ namespace Mist {
H.Clean(); H.Clean();
H.SetHeader("Content-Type", "video/mp4"); H.SetHeader("Content-Type", "video/mp4");
H.setCORSHeaders();
H.StartResponse(H, myConn); H.StartResponse(H, myConn);
H.Chunkify(moof_box.asBox(), moof_box.boxedSize(), myConn); H.Chunkify(moof_box.asBox(), moof_box.boxedSize(), myConn);
int size = htonl(keySize + 8); int size = htonl(keySize + 8);
@ -437,12 +438,23 @@ namespace Mist {
void OutHSS::onHTTP() { void OutHSS::onHTTP() {
if (H.method == "OPTIONS"){
H.Clean();
H.SetHeader("Content-Type", "application/octet-stream");
H.SetHeader("Cache-Control", "no-cache");
H.setCORSHeaders();
H.SetBody("");
H.SendResponse("200", "OK", myConn);
H.Clean();
return;
}
initialize(); initialize();
if (H.url.find("Manifest") != std::string::npos) { if (H.url.find("Manifest") != std::string::npos) {
//Manifest, direct reply //Manifest, direct reply
H.Clean(); H.Clean();
H.SetHeader("Content-Type", "text/xml"); H.SetHeader("Content-Type", "text/xml");
H.SetHeader("Cache-Control", "no-cache"); H.SetHeader("Cache-Control", "no-cache");
H.setCORSHeaders();
std::string manifest = smoothIndex(); std::string manifest = smoothIndex();
H.SetBody(manifest); H.SetBody(manifest);
H.SendResponse("200", "OK", myConn); H.SendResponse("200", "OK", myConn);