Added generic session ID overrider.

This commit is contained in:
Thulinma 2016-05-18 13:24:23 +02:00
parent a5353b0acd
commit edb1d5ca67
5 changed files with 12 additions and 6 deletions

View file

@ -861,7 +861,6 @@ namespace Mist {
/*LTS-END*/
DEBUG_MSG(DLVL_MEDIUM, "MistOut client handler started");
while (config->is_active && myConn.connected() && (wantRequest || parseData)){
stats();
if (wantRequest){
requestHandler();
}

View file

@ -108,6 +108,7 @@ namespace Mist {
virtual std::string getConnectedHost();
virtual std::string getConnectedBinHost();
virtual std::string getStatsName();
virtual bool hasSessionIDs(){return false;}
IPC::sharedClient statsPage;///< Shared memory used for statistics reporting.
bool isBlocking;///< If true, indicates that myConn is blocking.

View file

@ -370,6 +370,7 @@ namespace Mist {
VLCworkaround = true;
}
}
initialize();
if (H.url.substr(5 + streamName.size(), 5) == "/push"){
std::string relPushUrl = H.url.substr(10 + streamName.size());

View file

@ -10,7 +10,8 @@ namespace Mist {
void sendTS(const char * tsData, unsigned int len=188);
void onHTTP();
bool isReadyForPlay();
protected:
protected:
bool hasSessionIDs(){return true;}
std::string liveIndex();
std::string liveIndex(int tid, std::string & sessId);

View file

@ -211,10 +211,14 @@ namespace Mist {
void HTTPOutput::onRequest(){
while (H.Read(myConn)){
//If no sessionID --> take first 2, else take session id.
if (H.GetVar("sessId").size()){
std::string ua = H.GetVar("sessId");
crc = checksum::crc32(0, ua.data(), ua.size());
if (hasSessionIDs()){
if (H.GetVar("sessId").size()){
std::string ua = H.GetVar("sessId");
crc = checksum::crc32(0, ua.data(), ua.size());
}else{
std::string ua = JSON::Value((long long)getpid()).asString();
crc = checksum::crc32(0, ua.data(), ua.size());
}
}else{
std::string ua = H.GetHeader("User-Agent") + H.GetHeader("X-Playback-Session-Id");
crc = checksum::crc32(0, ua.data(), ua.size());