Пример #1
0
static bool isOnAccessControllRequestHeaderBlackList(const String& name)
{
    HashSet<String, CaseFoldingHash>* pList = XMLHttpRequest::getForbiddenHeadersBlackList();
    if(!pList)    
        return false;
    String proxyString("proxy-");
    String secString("sec-");
    
    return pList->contains(name) || name.startsWith(proxyString, false) ||
           name.startsWith(secString, false);
}
Пример #2
0
static SharedProxy GetProxyFromEnvironment(std::string prefix)
{
    Poco::toUpperInPlace(prefix);
    std::string envName = prefix + "_PROXY";

    std::string proxyString(EnvironmentUtils::Get(envName));
    if (!proxyString.empty())
        return ProxyConfig::ParseProxyEntry(proxyString, prefix, std::string());

    Poco::toLowerInPlace(prefix);
    envName = prefix + "_proxy";
    proxyString = EnvironmentUtils::Get(envName);
    if (!proxyString.empty())
        return ProxyConfig::ParseProxyEntry(proxyString, prefix, std::string());

    return 0;
}
Пример #3
0
Client::Client():
	authUser(0, "")
{
	int i = 0;
	std::string proxyString("");
	for(i = 0; i < THUMB_CACHE_SIZE; i++)
	{
		thumbnailCache[i] = NULL;
	}
	for(i = 0; i < IMGCONNS; i++)
	{
		activeThumbRequests[i] = NULL;
		activeThumbRequestTimes[i] = 0;
		activeThumbRequestCompleteTimes[i] = 0;
	}

	//Read config
	std::ifstream configFile;
	configFile.open("powder.pref", ios::binary);
	if(configFile)
	{
		int fsize = configFile.tellg();
		configFile.seekg(0, std::ios::end);
		fsize = configFile.tellg() - fsize;
		configFile.seekg(0, ios::beg);
		if(fsize)
		{
			json::Reader::Read(configDocument, configFile);
			try
			{
				authUser.ID = ((json::Number)(configDocument["User"]["ID"])).Value();
				authUser.SessionID = ((json::String)(configDocument["User"]["SessionID"])).Value();
				authUser.SessionKey = ((json::String)(configDocument["User"]["SessionKey"])).Value();
				authUser.Username = ((json::String)(configDocument["User"]["Username"])).Value();
			}
			catch (json::Exception &e)
			{
				authUser = User(0, "");
				std::cerr << "Error: Client [Read User data from pref] " << e.what() << std::endl;
			}
			try
			{
				proxyString = ((json::String)(configDocument["Proxy"])).Value();
			}
			catch (json::Exception &e)
			{
				proxyString = "";
				std::cerr << "Error: Client [Read Proxy from pref] " << e.what() << std::endl;
			}
		}
		configFile.close();
	}

	if(proxyString.length())
	{
		http_init((char *)proxyString.c_str());
	}
	else
	{
		http_init(NULL);
	}
}