Allow overriding application name with -DAPPNAME="Name here"
This commit is contained in:
		
							parent
							
								
									a8e04e1787
								
							
						
					
					
						commit
						771fad390a
					
				
					 21 changed files with 57 additions and 49 deletions
				
			
		|  | @ -13,7 +13,7 @@ namespace Mist{ | |||
|     setBlocking(true); | ||||
|     JSON::Value prep; | ||||
|     prep["cmd"] = "hi"; | ||||
|     prep["version"] = "MistServer " PACKAGE_VERSION; | ||||
|     prep["version"] = APPIDENT; | ||||
|     prep["pack_method"] = 2; | ||||
|     salt = Secure::md5("mehstuff" + JSON::Value((uint64_t)time(0)).asString()); | ||||
|     prep["salt"] = salt; | ||||
|  | @ -55,8 +55,7 @@ namespace Mist{ | |||
|     Output::init(cfg); | ||||
|     capa["name"] = "DTSC"; | ||||
|     capa["friendly"] = "DTSC"; | ||||
|     capa["desc"] = "Real time streaming over DTSC (MistServer proprietary protocol, for efficient " | ||||
|                    "inter-server streaming)"; | ||||
|     capa["desc"] = "Real time streaming over DTSC (proprietary protocol for efficient inter-server streaming)"; | ||||
|     capa["deps"] = ""; | ||||
|     capa["codecs"][0u][0u].append("+*"); | ||||
|     cfg->addConnectorOptions(4200, capa); | ||||
|  |  | |||
|  | @ -335,7 +335,7 @@ namespace Mist{ | |||
|       EBML::sendElemSeek(myConn, EBML::EID_CUES, seekheadSize + infoSize + tracksSize); | ||||
|     } | ||||
|     // Info
 | ||||
|     EBML::sendElemInfo(myConn, "MistServer " PACKAGE_VERSION, duration); | ||||
|     EBML::sendElemInfo(myConn, APPIDENT, duration); | ||||
|     // Tracks
 | ||||
|     size_t trackSizes = 0; | ||||
|     for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){ | ||||
|  | @ -497,7 +497,7 @@ namespace Mist{ | |||
|     // Segment contains SeekHead, Info, Tracks, Cues (in that order)
 | ||||
|     // Howeveer, SeekHead is dependent on Info/Tracks sizes, so we calculate those first.
 | ||||
|     // Calculating Info size
 | ||||
|     infoSize = EBML::sizeElemInfo("MistServer " PACKAGE_VERSION, duration); | ||||
|     infoSize = EBML::sizeElemInfo(APPIDENT, duration); | ||||
|     // Calculating Tracks size
 | ||||
|     tracksSize = 0; | ||||
|     for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){ | ||||
|  |  | |||
|  | @ -226,7 +226,7 @@ namespace Mist{ | |||
|     if (H.url == "/crossdomain.xml"){ | ||||
|       H.Clean(); | ||||
|       H.SetHeader("Content-Type", "text/xml"); | ||||
|       H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); | ||||
|       H.SetHeader("Server", APPIDENT); | ||||
|       H.setCORSHeaders(); | ||||
|       if (method == "OPTIONS" || method == "HEAD"){ | ||||
|         H.SendResponse("200", "OK", myConn); | ||||
|  | @ -415,7 +415,7 @@ namespace Mist{ | |||
|       return; | ||||
|     } | ||||
|     H.Clean(); // make sure no parts of old requests are left in any buffers
 | ||||
|     H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); | ||||
|     H.SetHeader("Server", APPIDENT); | ||||
|     H.setCORSHeaders(); | ||||
|     H.SetHeader("Content-Type", "application/vnd.apple.mpegurl"); | ||||
|     H.SetHeader("Cache-Control", "no-cache"); | ||||
|  |  | |||
|  | @ -58,7 +58,7 @@ namespace Mist{ | |||
|     INFO_MSG("Failing '%s': %s", H.url.c_str(), msg.c_str()); | ||||
|     if (!webSock && !isRecording()){ | ||||
|       H.Clean(); // make sure no parts of old requests are left in any buffers
 | ||||
|       H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); | ||||
|       H.SetHeader("Server", APPIDENT); | ||||
|       H.setCORSHeaders(); | ||||
|       H.SetBody("Could not retrieve stream: " + msg); | ||||
|       H.SendResponse("404", "Error opening stream", myConn); | ||||
|  | @ -208,7 +208,7 @@ namespace Mist{ | |||
|                H.GetVar("stream").c_str()); | ||||
|       if (!handler.size()){ | ||||
|         H.Clean(); | ||||
|         H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); | ||||
|         H.SetHeader("Server", APPIDENT); | ||||
|         H.setCORSHeaders(); | ||||
|         H.SetBody("<!DOCTYPE html><html><head><title>Unsupported Media " | ||||
|                   "Type</title></head><body><h1>Unsupported Media Type</h1>The server isn't quite " | ||||
|  |  | |||
|  | @ -375,7 +375,7 @@ namespace Mist{ | |||
|     H.Clean(); | ||||
|     H.SetHeader("Content-Type", "text/html"); | ||||
|     H.SetHeader("X-UA-Compatible", "IE=edge"); | ||||
|     H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); | ||||
|     H.SetHeader("Server", APPIDENT); | ||||
|     H.setCORSHeaders(); | ||||
|     if (method == "OPTIONS" || method == "HEAD"){ | ||||
|       H.SendResponse("200", "OK", myConn); | ||||
|  | @ -599,7 +599,7 @@ namespace Mist{ | |||
|         if (it->asStringRef().substr(0, cbToken.size() + 1) == cbToken + ":"){ | ||||
|           H.Clean(); | ||||
|           H.SetHeader("Content-Type", "text/plain"); | ||||
|           H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); | ||||
|           H.SetHeader("Server", APPIDENT); | ||||
|           H.setCORSHeaders(); | ||||
|           H.SetBody(it->asStringRef().substr(cbToken.size() + 1)); | ||||
|           H.SendResponse("200", "OK", myConn); | ||||
|  | @ -609,7 +609,7 @@ namespace Mist{ | |||
|       } | ||||
|       H.Clean(); | ||||
|       H.SetHeader("Content-Type", "text/plain"); | ||||
|       H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); | ||||
|       H.SetHeader("Server", APPIDENT); | ||||
|       H.setCORSHeaders(); | ||||
|       H.SetBody("No matching validation found for token '" + cbToken + "'"); | ||||
|       H.SendResponse("404", "Not found", myConn); | ||||
|  | @ -620,7 +620,7 @@ namespace Mist{ | |||
|     if (H.url == "/crossdomain.xml"){ | ||||
|       H.Clean(); | ||||
|       H.SetHeader("Content-Type", "text/xml"); | ||||
|       H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); | ||||
|       H.SetHeader("Server", APPIDENT); | ||||
|       H.setCORSHeaders(); | ||||
|       if (method == "OPTIONS" || method == "HEAD"){ | ||||
|         H.SendResponse("200", "OK", myConn); | ||||
|  | @ -639,7 +639,7 @@ namespace Mist{ | |||
|     if (H.url == "/clientaccesspolicy.xml"){ | ||||
|       H.Clean(); | ||||
|       H.SetHeader("Content-Type", "text/xml"); | ||||
|       H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); | ||||
|       H.SetHeader("Server", APPIDENT); | ||||
|       H.setCORSHeaders(); | ||||
|       if (method == "OPTIONS" || method == "HEAD"){ | ||||
|         H.SendResponse("200", "OK", myConn); | ||||
|  | @ -660,7 +660,7 @@ namespace Mist{ | |||
|     if (H.url == "/flashplayer.swf"){ | ||||
|       H.Clean(); | ||||
|       H.SetHeader("Content-Type", "application/x-shockwave-flash"); | ||||
|       H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); | ||||
|       H.SetHeader("Server", APPIDENT); | ||||
|       H.SetBody((const char *)FlashMediaPlayback_101_swf, FlashMediaPlayback_101_swf_len); | ||||
|       H.SendResponse("200", "OK", myConn); | ||||
|       return; | ||||
|  | @ -668,7 +668,7 @@ namespace Mist{ | |||
|     if (H.url == "/oldflashplayer.swf"){ | ||||
|       H.Clean(); | ||||
|       H.SetHeader("Content-Type", "application/x-shockwave-flash"); | ||||
|       H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); | ||||
|       H.SetHeader("Server", APPIDENT); | ||||
|       H.SetBody((const char *)FlashMediaPlayback_swf, FlashMediaPlayback_swf_len); | ||||
|       H.SendResponse("200", "OK", myConn); | ||||
|       return; | ||||
|  | @ -723,7 +723,7 @@ namespace Mist{ | |||
| 
 | ||||
|       H.Clean(); | ||||
|       H.SetHeader("Content-Type", "application/smil"); | ||||
|       H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); | ||||
|       H.SetHeader("Server", APPIDENT); | ||||
|       H.setCORSHeaders(); | ||||
|       if (method == "OPTIONS" || method == "HEAD"){ | ||||
|         H.SendResponse("200", "OK", myConn); | ||||
|  | @ -747,7 +747,7 @@ namespace Mist{ | |||
|       std::string rURL = H.url; | ||||
|       if (method != "OPTIONS" && method != "HEAD"){initialize();} | ||||
|       H.Clean(); | ||||
|       H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); | ||||
|       H.SetHeader("Server", APPIDENT); | ||||
|       H.setCORSHeaders(); | ||||
|       if (rURL.substr(0, 6) != "/json_"){ | ||||
|         H.SetHeader("Content-Type", "application/javascript"); | ||||
|  | @ -787,7 +787,7 @@ namespace Mist{ | |||
|       std::string response; | ||||
|       std::string rURL = H.url; | ||||
|       H.Clean(); | ||||
|       H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); | ||||
|       H.SetHeader("Server", APPIDENT); | ||||
|       H.setCORSHeaders(); | ||||
|       H.SetHeader("Content-Type", "application/javascript; charset=utf-8"); | ||||
|       if (method == "OPTIONS" || method == "HEAD"){ | ||||
|  | @ -860,7 +860,7 @@ namespace Mist{ | |||
|       std::string response; | ||||
|       std::string url = H.url; | ||||
|       H.Clean(); | ||||
|       H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); | ||||
|       H.SetHeader("Server", APPIDENT); | ||||
|       H.setCORSHeaders(); | ||||
|       H.SetHeader("Content-Type", "text/css"); | ||||
|       if (method == "OPTIONS" || method == "HEAD"){ | ||||
|  | @ -893,7 +893,7 @@ namespace Mist{ | |||
|     if (H.url == "/videojs.js"){ | ||||
|       std::string response; | ||||
|       H.Clean(); | ||||
|       H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); | ||||
|       H.SetHeader("Server", APPIDENT); | ||||
|       H.setCORSHeaders(); | ||||
|       H.SetHeader("Content-Type", "application/javascript"); | ||||
|       if (method == "OPTIONS" || method == "HEAD"){ | ||||
|  | @ -913,7 +913,7 @@ namespace Mist{ | |||
|     if (H.url == "/dashjs.js"){ | ||||
|       std::string response; | ||||
|       H.Clean(); | ||||
|       H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); | ||||
|       H.SetHeader("Server", APPIDENT); | ||||
|       H.setCORSHeaders(); | ||||
|       H.SetHeader("Content-Type", "application/javascript"); | ||||
|       if (method == "OPTIONS" || method == "HEAD"){ | ||||
|  | @ -935,7 +935,7 @@ namespace Mist{ | |||
|     if (H.url == "/webrtc.js"){ | ||||
|       std::string response; | ||||
|       H.Clean(); | ||||
|       H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); | ||||
|       H.SetHeader("Server", APPIDENT); | ||||
|       H.setCORSHeaders(); | ||||
|       H.SetHeader("Content-Type", "application/javascript"); | ||||
|       if (method == "OPTIONS" || method == "HEAD"){ | ||||
|  | @ -979,7 +979,7 @@ namespace Mist{ | |||
|     /*LTS-START*/ | ||||
|     if (H.GetVar("s").size() && H.GetVar("s") == SUPER_SECRET){ | ||||
|       H.Clean(); | ||||
|       H.SetHeader("Server", "mistserver/" PACKAGE_VERSION); | ||||
|       H.SetHeader("Server", APPIDENT); | ||||
|       H.setCORSHeaders(); | ||||
|       if (method == "OPTIONS" || method == "HEAD"){ | ||||
|         H.SendResponse("200", "OK", myConn); | ||||
|  | @ -995,7 +995,7 @@ namespace Mist{ | |||
|     H.Clean(); | ||||
| #include "../icon.h" | ||||
|     H.SetHeader("Content-Type", "image/x-icon"); | ||||
|     H.SetHeader("Server", "MistServer/" PACKAGE_VERSION); | ||||
|     H.SetHeader("Server", APPIDENT); | ||||
|     H.SetHeader("Content-Length", icon_len); | ||||
|     H.setCORSHeaders(); | ||||
|     if (method == "OPTIONS" || method == "HEAD"){ | ||||
|  |  | |||
|  | @ -48,7 +48,7 @@ namespace Mist{ | |||
|         WARN_MSG("URL %s is not inside webroot %s: %s", H.url.c_str(), resolved_path.c_str(), path.c_str()); | ||||
|       } | ||||
|       H.Clean(); | ||||
|       H.SetHeader("Server", "mistserver/" PACKAGE_VERSION); | ||||
|       H.SetHeader("Server", APPIDENT); | ||||
|       H.setCORSHeaders(); | ||||
|       if (method == "OPTIONS" || method == "HEAD"){ | ||||
|         H.SendResponse("200", "OK", myConn); | ||||
|  | @ -65,7 +65,7 @@ namespace Mist{ | |||
|     unsigned long long filesize = inFile.tellg(); | ||||
|     inFile.seekg(0, std::ios_base::beg); | ||||
|     H.Clean(); | ||||
|     H.SetHeader("Server", "mistserver/" PACKAGE_VERSION); | ||||
|     H.SetHeader("Server", APPIDENT); | ||||
|     H.SetHeader("Content-Length", filesize); | ||||
|     H.setCORSHeaders(); | ||||
|     if (method == "OPTIONS" || method == "HEAD"){ | ||||
|  |  | |||
|  | @ -223,7 +223,7 @@ namespace Mist{ | |||
| 
 | ||||
|     // seed the rng
 | ||||
|     if ((ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, | ||||
|                                      (const unsigned char *)"MistServer", 10)) != 0){ | ||||
|                                      (const unsigned char *)APPNAME, strlen(APPNAME))) != 0){ | ||||
|       FAIL_MSG("Could not seed the random number generator!"); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -138,7 +138,7 @@ namespace Mist{ | |||
|     amfReply.getContentP(2)->addContent(AMF::Object("app", app + args)); | ||||
|     amfReply.getContentP(2)->addContent(AMF::Object("type", "nonprivate")); | ||||
|     amfReply.getContentP(2)->addContent( | ||||
|         AMF::Object("flashVer", "FMLE/3.0 (compatible; MistServer/" PACKAGE_VERSION "/" RELEASE ")")); | ||||
|         AMF::Object("flashVer", "FMLE/3.0 (compatible; " APPNAME ")")); | ||||
|     amfReply.getContentP(2)->addContent(AMF::Object("tcUrl", pushHost + app + args)); | ||||
|     sendCommand(amfReply, 20, 0); | ||||
| 
 | ||||
|  |  | |||
|  | @ -189,7 +189,7 @@ namespace Mist{ | |||
|                       << reqUrl | ||||
|                       << "\r\n" | ||||
|                          "t=0 0\r\n" | ||||
|                          "a=tool:MistServer\r\n" | ||||
|                          "a=tool:" APPIDENT "\r\n" | ||||
|                          "a=type:broadcast\r\n" | ||||
|                          "a=control:*\r\n" | ||||
|                       << "a=range:npt=" << ((double)startTime()) / 1000.0 << "-" | ||||
|  | @ -327,7 +327,7 @@ namespace Mist{ | |||
|                         << reqUrl | ||||
|                         << "\r\n" | ||||
|                            "t=0 0\r\n" | ||||
|                            "a=tool:MistServer\r\n" | ||||
|                            "a=tool:" APPIDENT "\r\n" | ||||
|                            "a=type:broadcast\r\n" | ||||
|                            "a=control:*\r\n" | ||||
|                         << "a=range:npt=" << ((double)startTime()) / 1000.0 << "-" | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Thulinma
						Thulinma