예제 #1
0
bool LLAvatarNameCache::expirationFromCacheControl(const LLSD& headers, F64 *expires)
{
	bool fromCacheControl = false;
	F64 now = LLFrameTimer::getTotalSeconds();

	// Allow the header to override the default
	std::string cache_control;
	if (headers.has(HTTP_IN_HEADER_CACHE_CONTROL))
	{
		cache_control = headers[HTTP_IN_HEADER_CACHE_CONTROL].asString();
	}

	if (!cache_control.empty())
	{
		S32 max_age = 0;
		if (max_age_from_cache_control(cache_control, &max_age))
		{
			*expires = now + (F64)max_age;
			fromCacheControl = true;
		}
	}
	LL_DEBUGS("AvNameCache") << "LLAvatarNameCache "
		<< ( fromCacheControl ? "expires based on cache control " : "default expiration " )
		<< "in " << *expires - now << " seconds"
		<< LL_ENDL;
	
	return fromCacheControl;
}
예제 #2
0
bool LLAvatarNameCache::expirationFromCacheControl(LLSD headers, F64 *expires)
{
	// Allow the header to override the default
	LLSD cache_control_header = headers["cache-control"];
	if (cache_control_header.isDefined())
	{
		S32 max_age = 0;
		std::string cache_control = cache_control_header.asString();
		if (max_age_from_cache_control(cache_control, &max_age))
		{
			F64 now = LLFrameTimer::getTotalSeconds();
			*expires = now + (F64)max_age;
			return true;
		}
	}
	return false;
}
예제 #3
0
	bool expirationFromCacheControl(LLSD headers, F64 *expires)
	{
		// Allow the header to override the default
		LLSD cache_control_header = headers["cache-control"];
		if (cache_control_header.isDefined())
		{
			S32 max_age = 0;
			std::string cache_control = cache_control_header.asString();
			if (max_age_from_cache_control(cache_control, &max_age))
			{
				LL_WARNS("ExperienceCache") 
					<< "got EXPIRES from headers, max_age " << max_age 
					<< LL_ENDL;
				F64 now = LLFrameTimer::getTotalSeconds();
				*expires = now + (F64)max_age;
				return true;
			}
		}
		return false;
	}
bool LLAvatarNameCache::expirationFromCacheControl(AIHTTPReceivedHeaders const& headers, F64* expires)
{
	bool fromCacheControl = false;
	F64 now = LLFrameTimer::getTotalSeconds();
	// Allow the header to override the default
	std::string cache_control;
	if (headers.getFirstValue("cache-control", cache_control))
	{
		S32 max_age = 0;
		if (max_age_from_cache_control(cache_control, &max_age))
		{
			*expires = now + (F64)max_age;
			fromCacheControl = true;
		}
	}
	LL_DEBUGS("AvNameCache")
		<< ( fromCacheControl ? "expires based on cache control " : "default expiration " )
		<< "in " << *expires - now << " seconds"
		<< LL_ENDL;

	return fromCacheControl;
}
예제 #5
0
bool LLAvatarNameCache::expirationFromCacheControl(LLSD headers, F64 *expires)
{
	bool fromCacheControl = false;
	F64 now = LLFrameTimer::getTotalSeconds();

	// Allow the header to override the default
	LLSD cache_control_header = headers["cache-control"];
	if (cache_control_header.isDefined())
	{
		S32 max_age = 0;
		std::string cache_control = cache_control_header.asString();
		if (max_age_from_cache_control(cache_control, &max_age))
		{
			*expires = now + (F64)max_age;
			fromCacheControl = true;
		}
	}
	LL_DEBUGS("AvNameCache")
		<< ( fromCacheControl ? "expires based on cache control " : "default expiration " )
		<< "in " << *expires - now << " seconds"
		<< LL_ENDL;
	
	return fromCacheControl;
}