1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-02-24 05:37:14 +01:00
SqMod/vendor/POCO/Net/src/HTTPSessionInstantiator.cpp

69 lines
1.3 KiB
C++
Raw Normal View History

//
// HTTPSessionInstantiator.cpp
//
// Library: Net
// Package: HTTPClient
// Module: HTTPSessionInstantiator
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#include "Poco/Net/HTTPSessionInstantiator.h"
#include "Poco/Net/HTTPSessionFactory.h"
#include "Poco/Net/HTTPClientSession.h"
using Poco::URI;
namespace Poco {
namespace Net {
2021-08-22 18:07:06 +03:00
HTTPSessionInstantiator::HTTPSessionInstantiator()
{
}
HTTPSessionInstantiator::~HTTPSessionInstantiator()
{
}
HTTPClientSession* HTTPSessionInstantiator::createClientSession(const Poco::URI& uri)
{
poco_assert (uri.getScheme() == "http");
HTTPClientSession* pSession = new HTTPClientSession(uri.getHost(), uri.getPort());
2021-08-22 18:07:06 +03:00
if (!getProxyConfig().host.empty())
{
2021-08-22 18:07:06 +03:00
pSession->setProxyConfig(getProxyConfig());
}
return pSession;
}
void HTTPSessionInstantiator::registerInstantiator()
{
HTTPSessionFactory::defaultFactory().registerProtocol("http", new HTTPSessionInstantiator);
}
void HTTPSessionInstantiator::unregisterInstantiator()
{
HTTPSessionFactory::defaultFactory().unregisterProtocol("http");
}
2021-08-22 18:07:06 +03:00
void HTTPSessionInstantiator::setProxyConfig(const HTTPClientSession::ProxyConfig& proxyConfig)
{
2021-08-22 18:07:06 +03:00
_proxyConfig = proxyConfig;
}
} } // namespace Poco::Net