コード例 #1
0
void VHTTPServerLogBackupSettings::ResetToFactorySettings()
{
	SetLogRotationMode (LRC_ROTATE_ON_FILE_SIZE);
	SetLogMaxSize (HTTP_SERVER_LOG_DEFAULT_SIZE);
	SetFrequency (0);
	SetStartingTime (0);
	fDaysHours.clear();
}
コード例 #2
0
VHTTPServerLogBackupSettings& VHTTPServerLogBackupSettings::operator = (const VHTTPServerLogBackupSettings& inValue)
{
	if (&inValue != this)
	{
		SetLogRotationMode (inValue.fLogRotationMode);
		SetLogMaxSize (inValue.fLogMaxSize);
		SetFrequency (inValue.fFrequency);
		SetStartingTime (inValue.fStartingTime);
		SetDaysHoursMap (inValue.fDaysHours);
	}

	return *this;
}
コード例 #3
0
XBOX::VError VHTTPServerProjectSettings::LoadFromBag (const XBOX::VValueBag *inBag)
{
	if (NULL == inBag)
		return XBOX::VE_INVALID_PARAMETER;

#if 0 /*VERSIONDEBUG*/
	XBOX::VString xmlString ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
	inBag->DumpXML (xmlString, CVSTR ("settings"), true);
#endif

	/* Project settings */
	const XBOX::VValueBag *projectSettings = RetainSettings (inBag, RIASettingsKeys::Project::kXmlElement);
	if (projectSettings)
	{
		XBOX::VString ipString = RIASettingsKeys::Project::listen.Get (projectSettings);
#if WITH_DEPRECATED_IPV4_API
		fListeningAddress = ServerNetTools::GetIPAddress (ipString);
#else
		fListeningAddress.FromString (ipString);
#endif		
		fHostName = RIASettingsKeys::Project::hostName.Get (projectSettings);
#if HTTP_SERVER_USE_PROJECT_PATTERNS
		fProjectPattern = RIASettingsKeys::Project::pattern.Get (projectSettings);
#endif

#if WITH_DEPRECATED_IPV4_API
		if ((fListeningAddress != 0) && (fListeningAddress != LOCALHOST_ADDRESS))
#else
		if ((fListeningAddress != XBOX::VNetAddress::GetAnyIP()) && (fListeningAddress != XBOX::VNetAddress::GetLoopbackIP()))
#endif		
		{
#if WITH_DEPRECATED_IPV4_API
			std::vector<IP4> ipv4Addresses;
			if (ServerNetTools::GetLocalIPv4Addresses (ipv4Addresses) > 0)
			{
				if (!FindValueInVector (ipv4Addresses, fListeningAddress))
					fListeningAddress = 0; // Listening on all IP addresses
			}
#else
			XBOX::VectorOfVString	localIPAddresses;

			if (HTTPServerTools::GetLocalIPAddresses (localIPAddresses) > 0)
			{
				if (!FindValueInVector (localIPAddresses, fListeningAddress))
					fListeningAddress.FromString (XBOX::VNetAddress::GetAnyIP()); // Listening on all IP addresses
			}
#endif			
		}

		XBOX::VString authType;
		RIASettingsKeys::Project::realm.Get (projectSettings, fRealm);
		RIASettingsKeys::Project::authType.Get (projectSettings, authType);
		fAuthType = HTTPServerTools::GetAuthenticationMethodFromName (authType);

		XBOX::QuickReleaseRefCountable (projectSettings);
	}


	/*  HTTP Settings */
	const XBOX::VValueBag *httpSettings = RetainSettings (inBag, RIASettingsKeys::HTTP::kXmlElement);
	if (httpSettings)
	{
		fPort = RIASettingsKeys::HTTP::port.Get (httpSettings);
		fAllowSSL = RIASettingsKeys::HTTP::allowSSL.Get (httpSettings);
		fSSLMandatory = RIASettingsKeys::HTTP::SSLMandatory.Get (httpSettings);
		fSSLPort = RIASettingsKeys::HTTP::SSLPort.Get (httpSettings);

		if (fSSLMandatory && !fAllowSSL)
			fAllowSSL = true;

		if (fAllowSSL)
		{
			XBOX::VString certificatePath = RIASettingsKeys::HTTP::SSLCertificatePath.Get (httpSettings);
			BuildFolderPath (fProjectFolderPath, certificatePath, fSSLCertificatesFolderPath);
		}

		XBOX::VString charSetString = RIASettingsKeys::HTTP::standardSet.Get (httpSettings);
		XBOX::CharSet charSet = VTextConverters::Get()->GetCharSetFromName (charSetString);
		fDefaultCharSet = (charSet != XBOX::VTC_UNKNOWN) ? charSet : XBOX::VTC_UTF_8;

		/* cache settings */
		fEnableCache = RIASettingsKeys::HTTP::useCache.Get (httpSettings);
		fCacheMaxSize = RIASettingsKeys::HTTP::pageCacheSize.Get (httpSettings) * 1024;			// expressed in Kilo-Bytes in settings file
		fCachedObjectMaxSize = RIASettingsKeys::HTTP::cachedObjectMaxSize.Get (httpSettings);	// expressed in Bytes in settings file

		/* compression settings */
		fEnableCompression = RIASettingsKeys::HTTP::allowCompression.Get (httpSettings);
		fCompressionMinThreshold = RIASettingsKeys::HTTP::compressionMinThreshold.Get (httpSettings);
		fCompressionMaxThreshold = RIASettingsKeys::HTTP::compressionMaxThreshold.Get (httpSettings);

		/* Keep-Alive settings */
		fEnableKeepAlive = RIASettingsKeys::HTTP::acceptKeepAliveConnections.Get (httpSettings);
/* Temporary disable theses settings loading... because of a bug with long timeout values (sic...)
		fKeepAliveTimeout = RIASettingsKeys::HTTP::maximumTimeout.Get (httpSettings);
		fKeepAliveMaxConnections = RIASettingsKeys::HTTP::maximumRequestsByConnection.Get (httpSettings);
*/

		/* Log settings */
		fLogFormat = HTTPServerTools::GetLogFormatFromName (RIASettingsKeys::HTTP::logFormat.Get (httpSettings));
		SetLogRotationMode (LRC_ROTATE_ON_FILE_SIZE);
		SetLogMaxSize (RIASettingsKeys::HTTP::logMaxSize.Get (httpSettings));
		XBOX::VString logFolderPathString = RIASettingsKeys::HTTP::logPath.Get (httpSettings);
		BuildFolderPath (fProjectFolderPath, logFolderPathString, fLogFolderPath);
		fLogFileName = RIASettingsKeys::HTTP::logFileName.Get (httpSettings);

		const XBOX::VBagArray *logTokens = RetainMultipleSettings (httpSettings, RIASettingsKeys::HTTP::Log::kXmlElement);
		if (NULL != logTokens)
		{
			XBOX::VIndex count = logTokens->GetCount();

			if (count > 0)
			{
				XBOX::VString tokenName;
				XBOX::VTaskLock lock (&fLogTokensVectorLock);

				fLogTokensVector.clear();
				for (XBOX::VIndex i = 1; i <= count; ++i)
				{
					const XBOX::VValueBag *bag = logTokens->GetNth (i);
					if (NULL != bag)
					{
						bag->GetString (RIASettingsKeys::HTTP::Log::field, tokenName);
						if (!tokenName.IsEmpty())
						{
							EHTTPServerLogToken token = HTTPServerTools::GetLogTokenFromName (tokenName);
							if (token != LOG_TOKEN_NONE)
								AppendUniqueValueToVector (fLogTokensVector, token);
						}
					}
				}
			}

			XBOX::QuickReleaseRefCountable (logTokens);
		}

		XBOX::QuickReleaseRefCountable (httpSettings);
	}

	/* Web App settings */
	const XBOX::VValueBag *webAppSettings = RetainSettings (inBag, RIASettingsKeys::WebApp::kXmlElement);
	if (webAppSettings)
	{
		XBOX::VString webFolderPath;
		webFolderPath = RIASettingsKeys::WebApp::documentRoot.Get (webAppSettings);
		BuildFolderPath (fProjectFolderPath, webFolderPath, fWebFolderPath);
		fIndexPageName = RIASettingsKeys::WebApp::directoryIndex.Get (webAppSettings);

		XBOX::QuickReleaseRefCountable (webAppSettings);
	}

	/* Resources settings */
	LoadResourcesSettingsFromBag( *inBag);

	/* Virtual Folders settings */
	LoadVirtualFoldersSettingsFromBag( *inBag);

	Tell_SettingsChanged();

	return XBOX::VE_OK;
}