Merge branch 'poco-1.10.0' of https://github.com/pocoproject/poco into poco-1.10.0

This commit is contained in:
Francis ANDRE 2019-12-17 10:10:01 +01:00
commit 4e87b69de4
19 changed files with 85 additions and 229 deletions

View File

@ -175,19 +175,19 @@ extern "C" int ApacheConnector_handler(request_rec *r)
{ {
ApacheRequestRec rec(r); ApacheRequestRec rec(r);
ApacheApplication& app(ApacheApplication::instance()); ApacheApplication& app(ApacheApplication::instance());
try try
{ {
// ensure application is ready // ensure application is ready
app.setup(); app.setup();
// if the ApacheRequestHandler declines handling - we stop // if the ApacheRequestHandler declines handling - we stop
// request handling here and let other modules do their job! // request handling here and let other modules do their job!
if (!app.factory().mustHandle(r->uri)) if (!app.factory().mustHandle(r->uri))
return DECLINED; return DECLINED;
apr_status_t rv; apr_status_t rv;
if ((rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK))) if ((rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)))
return rv; return rv;
// The properties conn_rec->remote_ip and conn_rec->remote_addr have undergone significant changes in Apache 2.4. // The properties conn_rec->remote_ip and conn_rec->remote_addr have undergone significant changes in Apache 2.4.
@ -199,16 +199,6 @@ extern "C" int ApacheConnector_handler(request_rec *r)
const char* clientIp = r->connection->client_ip; const char* clientIp = r->connection->client_ip;
apr_port_t clientPort = r->connection->client_addr->port; apr_port_t clientPort = r->connection->client_addr->port;
#endif #endif
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<ApacheServerRequest> pRequest(new ApacheServerRequest(
&rec,
r->connection->local_ip,
r->connection->local_addr->port,
clientIp,
clientPort));
std::auto_ptr<ApacheServerResponse> pResponse(new ApacheServerResponse(pRequest.get()));
#else
std::unique_ptr<ApacheServerRequest> pRequest(new ApacheServerRequest( std::unique_ptr<ApacheServerRequest> pRequest(new ApacheServerRequest(
&rec, &rec,
r->connection->local_ip, r->connection->local_ip,
@ -217,22 +207,17 @@ extern "C" int ApacheConnector_handler(request_rec *r)
clientPort)); clientPort));
std::unique_ptr<ApacheServerResponse> pResponse(new ApacheServerResponse(pRequest.get())); std::unique_ptr<ApacheServerResponse> pResponse(new ApacheServerResponse(pRequest.get()));
#endif // POCO_ENABLE_CPP11
// add header information to request // add header information to request
rec.copyHeaders(*pRequest); rec.copyHeaders(*pRequest);
try try
{ {
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<HTTPRequestHandler> pHandler(app.factory().createRequestHandler(*pRequest));
#else
std::unique_ptr<HTTPRequestHandler> pHandler(app.factory().createRequestHandler(*pRequest)); std::unique_ptr<HTTPRequestHandler> pHandler(app.factory().createRequestHandler(*pRequest));
#endif // POCO_ENABLE_CPP11
if (pHandler.get()) if (pHandler.get())
{ {
pHandler->handleRequest(*pRequest, *pResponse); pHandler->handleRequest(*pRequest, *pResponse);
} }
else else
@ -300,25 +285,25 @@ extern "C" const char* ApacheConnector_config(cmd_parms *cmd, void *in_dconf, co
} }
extern "C" const command_rec ApacheConnector_cmds[] = extern "C" const command_rec ApacheConnector_cmds[] =
{ {
AP_INIT_RAW_ARGS( AP_INIT_RAW_ARGS(
"AddPocoRequestHandler", "AddPocoRequestHandler",
reinterpret_cast<cmd_func>(ApacheConnector_uris), reinterpret_cast<cmd_func>(ApacheConnector_uris),
NULL, NULL,
RSRC_CONF, RSRC_CONF,
"POCO RequestHandlerFactory class name followed by shared library path followed by a list of ' ' separated URIs that must be handled by this module."), "POCO RequestHandlerFactory class name followed by shared library path followed by a list of ' ' separated URIs that must be handled by this module."),
AP_INIT_RAW_ARGS( AP_INIT_RAW_ARGS(
"AddPocoConfig", "AddPocoConfig",
reinterpret_cast<cmd_func>(ApacheConnector_config), reinterpret_cast<cmd_func>(ApacheConnector_config),
NULL, NULL,
RSRC_CONF, RSRC_CONF,
"Path of the POCO configuration file."), "Path of the POCO configuration file."),
{ NULL } { NULL }
}; };
module AP_MODULE_DECLARE_DATA poco_module = module AP_MODULE_DECLARE_DATA poco_module =
{ {
STANDARD20_MODULE_STUFF, STANDARD20_MODULE_STUFF,
NULL, NULL,

View File

@ -54,8 +54,8 @@ class TestCaller: public TestCase
typedef void (Fixture::*TestMethod)(); typedef void (Fixture::*TestMethod)();
public: public:
TestCaller(const std::string& name, TestMethod test, Test::Type testType = Test::Normal): TestCaller(const std::string& name, TestMethod test, Test::Type testType = Test::Normal):
TestCase(name, testType), TestCase(name, testType),
_test(test), _test(test),
_fixture(new Fixture(name)) _fixture(new Fixture(name))
{ {
@ -81,11 +81,7 @@ protected:
private: private:
TestMethod _test; TestMethod _test;
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<Fixture> _fixture;
#else
std::unique_ptr<Fixture> _fixture; std::unique_ptr<Fixture> _fixture;
#endif // POCO_ENABLE_CPP11
}; };

View File

@ -90,11 +90,7 @@ private:
void load(PKCS12* pPKCS12, const std::string& password = ""); void load(PKCS12* pPKCS12, const std::string& password = "");
std::string extractFriendlyName(X509* pCert); std::string extractFriendlyName(X509* pCert);
#ifdef POCO_ENABLE_CPP11
typedef std::unique_ptr<X509Certificate> CertPtr; typedef std::unique_ptr<X509Certificate> CertPtr;
#else
typedef std::auto_ptr<X509Certificate> CertPtr;
#endif // #ifdef POCO_ENABLE_CPP11
OpenSSLInitializer _openSSLInitializer; OpenSSLInitializer _openSSLInitializer;
EVP_PKEY* _pKey; EVP_PKEY* _pKey;

View File

@ -42,7 +42,7 @@ public:
} }
~DynamicFactory() ~DynamicFactory()
/// Destroys the DynamicFactory and deletes the instantiators for /// Destroys the DynamicFactory and deletes the instantiators for
/// all registered classes. /// all registered classes.
{ {
for (typename FactoryMap::iterator it = _map.begin(); it != _map.end(); ++it) for (typename FactoryMap::iterator it = _map.begin(); it != _map.end(); ++it)
@ -50,7 +50,7 @@ public:
delete it->second; delete it->second;
} }
} }
Base* createInstance(const std::string& className) const Base* createInstance(const std::string& className) const
/// Creates a new instance of the class with the given name. /// Creates a new instance of the class with the given name.
/// The class must have been registered with registerClass. /// The class must have been registered with registerClass.
@ -64,8 +64,8 @@ public:
else else
throw NotFoundException(className); throw NotFoundException(className);
} }
template <class C> template <class C>
void registerClass(const std::string& className) void registerClass(const std::string& className)
/// Registers the instantiator for the given class with the DynamicFactory. /// Registers the instantiator for the given class with the DynamicFactory.
/// The DynamicFactory takes ownership of the instantiator and deletes /// The DynamicFactory takes ownership of the instantiator and deletes
@ -75,7 +75,7 @@ public:
{ {
registerClass(className, new Instantiator<C, Base>); registerClass(className, new Instantiator<C, Base>);
} }
void registerClass(const std::string& className, AbstractFactory* pAbstractFactory) void registerClass(const std::string& className, AbstractFactory* pAbstractFactory)
/// Registers the instantiator for the given class with the DynamicFactory. /// Registers the instantiator for the given class with the DynamicFactory.
/// The DynamicFactory takes ownership of the instantiator and deletes /// The DynamicFactory takes ownership of the instantiator and deletes
@ -87,11 +87,7 @@ public:
FastMutex::ScopedLock lock(_mutex); FastMutex::ScopedLock lock(_mutex);
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<AbstractFactory> ptr(pAbstractFactory);
#else
std::unique_ptr<AbstractFactory> ptr(pAbstractFactory); std::unique_ptr<AbstractFactory> ptr(pAbstractFactory);
#endif // POCO_ENABLE_CPP11
typename FactoryMap::iterator it = _map.find(className); typename FactoryMap::iterator it = _map.find(className);
if (it == _map.end()) if (it == _map.end())
@ -99,7 +95,7 @@ public:
else else
throw ExistsException(className); throw ExistsException(className);
} }
void unregisterClass(const std::string& className) void unregisterClass(const std::string& className)
/// Unregisters the given class and deletes the instantiator /// Unregisters the given class and deletes the instantiator
/// for the class. /// for the class.
@ -115,7 +111,7 @@ public:
} }
else throw NotFoundException(className); else throw NotFoundException(className);
} }
bool isClass(const std::string& className) const bool isClass(const std::string& className) const
/// Returns true iff the given class has been registered. /// Returns true iff the given class has been registered.
{ {
@ -129,7 +125,7 @@ private:
DynamicFactory& operator = (const DynamicFactory&); DynamicFactory& operator = (const DynamicFactory&);
typedef std::map<std::string, AbstractFactory*> FactoryMap; typedef std::map<std::string, AbstractFactory*> FactoryMap;
FactoryMap _map; FactoryMap _map;
mutable FastMutex _mutex; mutable FastMutex _mutex;
}; };

View File

@ -58,11 +58,7 @@ void pad(std::string& str, int precision, int width, char prefix = ' ', char dec
std::string::size_type frac = str.length() - decSepPos - 1; std::string::size_type frac = str.length() - decSepPos - 1;
std::string::size_type ePos = str.find_first_of("eE"); std::string::size_type ePos = str.find_first_of("eE");
#ifdef POCO_ENABLE_CPP11
std::unique_ptr<std::string> eStr; std::unique_ptr<std::string> eStr;
#else
std::auto_ptr<std::string> eStr;
#endif
if (ePos != std::string::npos) if (ePos != std::string::npos)
{ {
eStr.reset(new std::string(str.substr(ePos, std::string::npos))); eStr.reset(new std::string(str.substr(ePos, std::string::npos)));
@ -201,7 +197,7 @@ std::string& floatToStr(std::string& str, float value, int precision, int width,
char buffer[POCO_MAX_FLT_STRING_LEN]; char buffer[POCO_MAX_FLT_STRING_LEN];
floatToStr(buffer, POCO_MAX_FLT_STRING_LEN, value); floatToStr(buffer, POCO_MAX_FLT_STRING_LEN, value);
str = buffer; str = buffer;
if (decSep && (decSep != '.') && (str.find('.') != std::string::npos)) if (decSep && (decSep != '.') && (str.find('.') != std::string::npos))
replaceInPlace(str, '.', decSep); replaceInPlace(str, '.', decSep);
@ -219,7 +215,7 @@ std::string& floatToFixedStr(std::string& str, float value, int precision, int w
char buffer[POCO_MAX_FLT_STRING_LEN]; char buffer[POCO_MAX_FLT_STRING_LEN];
floatToFixedStr(buffer, POCO_MAX_FLT_STRING_LEN, value, precision); floatToFixedStr(buffer, POCO_MAX_FLT_STRING_LEN, value, precision);
str = buffer; str = buffer;
if (decSep && (decSep != '.') && (str.find('.') != std::string::npos)) if (decSep && (decSep != '.') && (str.find('.') != std::string::npos))
replaceInPlace(str, '.', decSep); replaceInPlace(str, '.', decSep);
@ -263,9 +259,9 @@ std::string& doubleToStr(std::string& str, double value, int precision, int widt
char buffer[POCO_MAX_FLT_STRING_LEN]; char buffer[POCO_MAX_FLT_STRING_LEN];
doubleToStr(buffer, POCO_MAX_FLT_STRING_LEN, value); doubleToStr(buffer, POCO_MAX_FLT_STRING_LEN, value);
str = buffer; str = buffer;
if (decSep && (decSep != '.') && (str.find('.') != std::string::npos)) if (decSep && (decSep != '.') && (str.find('.') != std::string::npos))
replaceInPlace(str, '.', decSep); replaceInPlace(str, '.', decSep);
@ -282,9 +278,9 @@ std::string& doubleToFixedStr(std::string& str, double value, int precision, int
char buffer[POCO_MAX_FLT_STRING_LEN]; char buffer[POCO_MAX_FLT_STRING_LEN];
doubleToFixedStr(buffer, POCO_MAX_FLT_STRING_LEN, value, precision); doubleToFixedStr(buffer, POCO_MAX_FLT_STRING_LEN, value, precision);
str = buffer; str = buffer;
if (decSep && (decSep != '.') && (str.find('.') != std::string::npos)) if (decSep && (decSep != '.') && (str.find('.') != std::string::npos))
replaceInPlace(str, '.', decSep); replaceInPlace(str, '.', decSep);

View File

@ -28,16 +28,16 @@ namespace
Base() Base()
{ {
} }
virtual ~Base() virtual ~Base()
{ {
} }
}; };
class A: public Base class A: public Base
{ {
}; };
class B: public Base class B: public Base
{ {
}; };
@ -57,26 +57,21 @@ DynamicFactoryTest::~DynamicFactoryTest()
void DynamicFactoryTest::testDynamicFactory() void DynamicFactoryTest::testDynamicFactory()
{ {
DynamicFactory<Base> dynFactory; DynamicFactory<Base> dynFactory;
dynFactory.registerClass<A>("A"); dynFactory.registerClass<A>("A");
dynFactory.registerClass<B>("B"); dynFactory.registerClass<B>("B");
assertTrue (dynFactory.isClass("A")); assertTrue (dynFactory.isClass("A"));
assertTrue (dynFactory.isClass("B")); assertTrue (dynFactory.isClass("B"));
assertTrue (!dynFactory.isClass("C")); assertTrue (!dynFactory.isClass("C"));
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<A> a(dynamic_cast<A*>(dynFactory.createInstance("A")));
std::auto_ptr<B> b(dynamic_cast<B*>(dynFactory.createInstance("B")));
#else
std::unique_ptr<A> a(dynamic_cast<A*>(dynFactory.createInstance("A"))); std::unique_ptr<A> a(dynamic_cast<A*>(dynFactory.createInstance("A")));
std::unique_ptr<B> b(dynamic_cast<B*>(dynFactory.createInstance("B"))); std::unique_ptr<B> b(dynamic_cast<B*>(dynFactory.createInstance("B")));
#endif // POCO_ENABLE_CPP11
assertNotNull(a.get()); assertNotNull(a.get());
assertNotNull(b.get()); assertNotNull(b.get());
try try
{ {
dynFactory.registerClass<A>("A"); dynFactory.registerClass<A>("A");
@ -85,18 +80,14 @@ void DynamicFactoryTest::testDynamicFactory()
catch (Poco::ExistsException&) catch (Poco::ExistsException&)
{ {
} }
dynFactory.unregisterClass("B"); dynFactory.unregisterClass("B");
assertTrue (dynFactory.isClass("A")); assertTrue (dynFactory.isClass("A"));
assertTrue (!dynFactory.isClass("B")); assertTrue (!dynFactory.isClass("B"));
try try
{ {
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<B> b(dynamic_cast<B*>(dynFactory.createInstance("B")));
#else
std::unique_ptr<B> b(dynamic_cast<B*>(dynFactory.createInstance("B"))); std::unique_ptr<B> b(dynamic_cast<B*>(dynFactory.createInstance("B")));
#endif // POCO_ENABLE_CPP11
fail("unregistered - must throw"); fail("unregistered - must throw");
} }
catch (Poco::NotFoundException&) catch (Poco::NotFoundException&)

View File

@ -49,7 +49,7 @@ namespace
{ {
} }
}; };
class CustomFormatter: public Formatter class CustomFormatter: public Formatter
{ {
void format(const Message& msg, std::string& text) void format(const Message& msg, std::string& text)
@ -72,7 +72,7 @@ LoggingFactoryTest::~LoggingFactoryTest()
void LoggingFactoryTest::testBuiltins() void LoggingFactoryTest::testBuiltins()
{ {
LoggingFactory& fact = LoggingFactory::defaultFactory(); LoggingFactory& fact = LoggingFactory::defaultFactory();
AutoPtr<Channel> pConsoleChannel = fact.createChannel("ConsoleChannel"); AutoPtr<Channel> pConsoleChannel = fact.createChannel("ConsoleChannel");
#if defined(_WIN32) && !defined(_WIN32_WCE) #if defined(_WIN32) && !defined(_WIN32_WCE)
assertTrue (dynamic_cast<Poco::WindowsConsoleChannel*>(pConsoleChannel.get()) != 0); assertTrue (dynamic_cast<Poco::WindowsConsoleChannel*>(pConsoleChannel.get()) != 0);
@ -82,10 +82,10 @@ void LoggingFactoryTest::testBuiltins()
AutoPtr<Channel> pFileChannel = fact.createChannel("FileChannel"); AutoPtr<Channel> pFileChannel = fact.createChannel("FileChannel");
assertTrue (dynamic_cast<FileChannel*>(pFileChannel.get()) != 0); assertTrue (dynamic_cast<FileChannel*>(pFileChannel.get()) != 0);
AutoPtr<Channel> pSplitterChannel = fact.createChannel("SplitterChannel"); AutoPtr<Channel> pSplitterChannel = fact.createChannel("SplitterChannel");
assertTrue (dynamic_cast<SplitterChannel*>(pSplitterChannel.get()) != 0); assertTrue (dynamic_cast<SplitterChannel*>(pSplitterChannel.get()) != 0);
try try
{ {
AutoPtr<Channel> pUnknownChannel = fact.createChannel("UnknownChannel"); AutoPtr<Channel> pUnknownChannel = fact.createChannel("UnknownChannel");
@ -94,10 +94,10 @@ void LoggingFactoryTest::testBuiltins()
catch (Poco::NotFoundException&) catch (Poco::NotFoundException&)
{ {
} }
AutoPtr<Formatter> pPatternFormatter = fact.createFormatter("PatternFormatter"); AutoPtr<Formatter> pPatternFormatter = fact.createFormatter("PatternFormatter");
assertTrue (dynamic_cast<PatternFormatter*>(pPatternFormatter.get()) != 0); assertTrue (dynamic_cast<PatternFormatter*>(pPatternFormatter.get()) != 0);
try try
{ {
AutoPtr<Formatter> pUnknownFormatter = fact.createFormatter("UnknownFormatter"); AutoPtr<Formatter> pUnknownFormatter = fact.createFormatter("UnknownFormatter");
@ -111,11 +111,7 @@ void LoggingFactoryTest::testBuiltins()
void LoggingFactoryTest::testCustom() void LoggingFactoryTest::testCustom()
{ {
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<LoggingFactory> fact(new LoggingFactory);
#else
std::unique_ptr<LoggingFactory> fact(new LoggingFactory); std::unique_ptr<LoggingFactory> fact(new LoggingFactory);
#endif // POCO_ENABLE_CPP11
fact->registerChannelClass("CustomChannel", new Instantiator<CustomChannel, Channel>); fact->registerChannelClass("CustomChannel", new Instantiator<CustomChannel, Channel>);
fact->registerFormatterClass("CustomFormatter", new Instantiator<CustomFormatter, Formatter>); fact->registerFormatterClass("CustomFormatter", new Instantiator<CustomFormatter, Formatter>);

View File

@ -34,7 +34,7 @@ int main(int argc, char** argv)
{ {
HTTPStreamFactory::registerFactory(); HTTPStreamFactory::registerFactory();
FTPStreamFactory::registerFactory(); FTPStreamFactory::registerFactory();
if (argc != 2) if (argc != 2)
{ {
Path p(argv[0]); Path p(argv[0]);
@ -47,11 +47,7 @@ int main(int argc, char** argv)
try try
{ {
URI uri(argv[1]); URI uri(argv[1]);
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open(uri));
#else
std::unique_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open(uri)); std::unique_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open(uri));
#endif // POCO_ENABLE_CPP11
StreamCopier::copyStream(*pStr.get(), std::cout); StreamCopier::copyStream(*pStr.get(), std::cout);
} }
catch (Exception& exc) catch (Exception& exc)
@ -59,6 +55,6 @@ int main(int argc, char** argv)
std::cerr << exc.displayText() << std::endl; std::cerr << exc.displayText() << std::endl;
return 1; return 1;
} }
return 0; return 0;
} }

View File

@ -36,7 +36,7 @@ HTTPServerConnection::HTTPServerConnection(const StreamSocket& socket, HTTPServe
_stopped(false) _stopped(false)
{ {
poco_check_ptr (pFactory); poco_check_ptr (pFactory);
_pFactory->serverStopped += Poco::delegate(this, &HTTPServerConnection::onServerStopped); _pFactory->serverStopped += Poco::delegate(this, &HTTPServerConnection::onServerStopped);
} }
@ -67,7 +67,7 @@ void HTTPServerConnection::run()
{ {
HTTPServerResponseImpl response(session); HTTPServerResponseImpl response(session);
HTTPServerRequestImpl request(response, session, _pParams); HTTPServerRequestImpl request(response, session, _pParams);
Poco::Timestamp now; Poco::Timestamp now;
response.setDate(now); response.setDate(now);
response.setVersion(request.getVersion()); response.setVersion(request.getVersion());
@ -76,16 +76,12 @@ void HTTPServerConnection::run()
response.set("Server", server); response.set("Server", server);
try try
{ {
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<HTTPRequestHandler> pHandler(_pFactory->createRequestHandler(request));
#else
std::unique_ptr<HTTPRequestHandler> pHandler(_pFactory->createRequestHandler(request)); std::unique_ptr<HTTPRequestHandler> pHandler(_pFactory->createRequestHandler(request));
#endif
if (pHandler.get()) if (pHandler.get())
{ {
if (request.getExpectContinue() && response.getStatus() == HTTPResponse::HTTP_OK) if (request.getExpectContinue() && response.getStatus() == HTTPResponse::HTTP_OK)
response.sendContinue(); response.sendContinue();
pHandler->handleRequest(request, response); pHandler->handleRequest(request, response);
session.setKeepAlive(_pParams->getKeepAlive() && response.getKeepAlive() && session.canKeepAlive()); session.setKeepAlive(_pParams->getKeepAlive() && response.getKeepAlive() && session.canKeepAlive());
} }

View File

@ -35,11 +35,11 @@ public:
_socket(socket) _socket(socket)
{ {
} }
~TCPConnectionNotification() ~TCPConnectionNotification()
{ {
} }
const StreamSocket& socket() const const StreamSocket& socket() const
{ {
return _socket; return _socket;
@ -66,7 +66,7 @@ TCPServerDispatcher::TCPServerDispatcher(TCPServerConnectionFactory::Ptr pFactor
if (!_pParams) if (!_pParams)
_pParams = new TCPServerParams; _pParams = new TCPServerParams;
if (_pParams->getMaxThreads() == 0) if (_pParams->getMaxThreads() == 0)
_pParams->setMaxThreads(threadPool.capacity()); _pParams->setMaxThreads(threadPool.capacity());
} }
@ -108,18 +108,14 @@ void TCPServerDispatcher::run()
TCPConnectionNotification* pCNf = dynamic_cast<TCPConnectionNotification*>(pNf.get()); TCPConnectionNotification* pCNf = dynamic_cast<TCPConnectionNotification*>(pNf.get());
if (pCNf) if (pCNf)
{ {
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<TCPServerConnection> pConnection(_pConnectionFactory->createConnection(pCNf->socket()));
#else
std::unique_ptr<TCPServerConnection> pConnection(_pConnectionFactory->createConnection(pCNf->socket())); std::unique_ptr<TCPServerConnection> pConnection(_pConnectionFactory->createConnection(pCNf->socket()));
#endif // POCO_ENABLE_CPP11
poco_check_ptr(pConnection.get()); poco_check_ptr(pConnection.get());
beginConnection(); beginConnection();
pConnection->start(); pConnection->start();
endConnection(); endConnection();
} }
} }
FastMutex::ScopedLock lock(_mutex); FastMutex::ScopedLock lock(_mutex);
if (_stopped || (_currentThreads > 1 && _queue.empty())) if (_stopped || (_currentThreads > 1 && _queue.empty()))
{ {
@ -135,7 +131,7 @@ namespace
static const std::string threadName("TCPServerConnection"); static const std::string threadName("TCPServerConnection");
} }
void TCPServerDispatcher::enqueue(const StreamSocket& socket) void TCPServerDispatcher::enqueue(const StreamSocket& socket)
{ {
FastMutex::ScopedLock lock(_mutex); FastMutex::ScopedLock lock(_mutex);
@ -179,14 +175,14 @@ void TCPServerDispatcher::stop()
int TCPServerDispatcher::currentThreads() const int TCPServerDispatcher::currentThreads() const
{ {
FastMutex::ScopedLock lock(_mutex); FastMutex::ScopedLock lock(_mutex);
return _currentThreads; return _currentThreads;
} }
int TCPServerDispatcher::maxThreads() const int TCPServerDispatcher::maxThreads() const
{ {
FastMutex::ScopedLock lock(_mutex); FastMutex::ScopedLock lock(_mutex);
return _threadPool.capacity(); return _threadPool.capacity();
} }
@ -194,7 +190,7 @@ int TCPServerDispatcher::maxThreads() const
int TCPServerDispatcher::totalConnections() const int TCPServerDispatcher::totalConnections() const
{ {
FastMutex::ScopedLock lock(_mutex); FastMutex::ScopedLock lock(_mutex);
return _totalConnections; return _totalConnections;
} }
@ -202,7 +198,7 @@ int TCPServerDispatcher::totalConnections() const
int TCPServerDispatcher::currentConnections() const int TCPServerDispatcher::currentConnections() const
{ {
FastMutex::ScopedLock lock(_mutex); FastMutex::ScopedLock lock(_mutex);
return _currentConnections; return _currentConnections;
} }
@ -210,7 +206,7 @@ int TCPServerDispatcher::currentConnections() const
int TCPServerDispatcher::maxConcurrentConnections() const int TCPServerDispatcher::maxConcurrentConnections() const
{ {
FastMutex::ScopedLock lock(_mutex); FastMutex::ScopedLock lock(_mutex);
return _maxConcurrentConnections; return _maxConcurrentConnections;
} }
@ -224,7 +220,7 @@ int TCPServerDispatcher::queuedConnections() const
int TCPServerDispatcher::refusedConnections() const int TCPServerDispatcher::refusedConnections() const
{ {
FastMutex::ScopedLock lock(_mutex); FastMutex::ScopedLock lock(_mutex);
return _refusedConnections; return _refusedConnections;
} }
@ -232,7 +228,7 @@ int TCPServerDispatcher::refusedConnections() const
void TCPServerDispatcher::beginConnection() void TCPServerDispatcher::beginConnection()
{ {
FastMutex::ScopedLock lock(_mutex); FastMutex::ScopedLock lock(_mutex);
++_totalConnections; ++_totalConnections;
++_currentConnections; ++_currentConnections;
if (_currentConnections > _maxConcurrentConnections) if (_currentConnections > _maxConcurrentConnections)

View File

@ -79,16 +79,12 @@ void FTPStreamFactoryTest::testDownload()
uri.setPort(server.port()); uri.setPort(server.port());
uri.setPath("/test.txt;type=a"); uri.setPath("/test.txt;type=a");
FTPStreamFactory sf; FTPStreamFactory sf;
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(sf.open(uri));
#else
std::unique_ptr<std::istream> pStr(sf.open(uri)); std::unique_ptr<std::istream> pStr(sf.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream dataStr; std::ostringstream dataStr;
StreamCopier::copyStream(*pStr.get(), dataStr); StreamCopier::copyStream(*pStr.get(), dataStr);
pStr.reset(); pStr.reset();
std::string s(dataStr.str()); std::string s(dataStr.str());
assertTrue (s == "line1\r\nline2\r\n"); assertTrue (s == "line1\r\nline2\r\n");
} }
@ -120,17 +116,13 @@ void FTPStreamFactoryTest::testList()
uri.setPort(server.port()); uri.setPort(server.port());
uri.setPath("/usr/guest/data;type=d"); uri.setPath("/usr/guest/data;type=d");
FTPStreamFactory sf; FTPStreamFactory sf;
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(sf.open(uri));
#else
std::unique_ptr<std::istream> pStr(sf.open(uri)); std::unique_ptr<std::istream> pStr(sf.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream dataStr; std::ostringstream dataStr;
StreamCopier::copyStream(*pStr.get(), dataStr); StreamCopier::copyStream(*pStr.get(), dataStr);
pStr.reset(); pStr.reset();
std::string s(dataStr.str()); std::string s(dataStr.str());
assertTrue (s == "file1\r\nfile2\r\n"); assertTrue (s == "file1\r\nfile2\r\n");
} }
@ -162,17 +154,13 @@ void FTPStreamFactoryTest::testUserInfo()
uri.setPath("/test.txt;type=a"); uri.setPath("/test.txt;type=a");
uri.setUserInfo("user:secret"); uri.setUserInfo("user:secret");
FTPStreamFactory sf; FTPStreamFactory sf;
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(sf.open(uri));
#else
std::unique_ptr<std::istream> pStr(sf.open(uri)); std::unique_ptr<std::istream> pStr(sf.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream dataStr; std::ostringstream dataStr;
StreamCopier::copyStream(*pStr.get(), dataStr); StreamCopier::copyStream(*pStr.get(), dataStr);
pStr.reset(); pStr.reset();
std::string s(dataStr.str()); std::string s(dataStr.str());
assertTrue (s == "line1\r\nline2\r\n"); assertTrue (s == "line1\r\nline2\r\n");
} }
@ -205,17 +193,13 @@ void FTPStreamFactoryTest::testPasswordProvider()
uri.setPath("/test.txt;type=a"); uri.setPath("/test.txt;type=a");
uri.setUserInfo("user"); uri.setUserInfo("user");
FTPStreamFactory sf; FTPStreamFactory sf;
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(sf.open(uri));
#else
std::unique_ptr<std::istream> pStr(sf.open(uri)); std::unique_ptr<std::istream> pStr(sf.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream dataStr; std::ostringstream dataStr;
StreamCopier::copyStream(*pStr.get(), dataStr); StreamCopier::copyStream(*pStr.get(), dataStr);
pStr.reset(); pStr.reset();
std::string s(dataStr.str()); std::string s(dataStr.str());
assertTrue (s == "line1\r\nline2\r\n"); assertTrue (s == "line1\r\nline2\r\n");
} }
@ -239,11 +223,7 @@ void FTPStreamFactoryTest::testMissingPasswordProvider()
try try
{ {
FTPStreamFactory sf; FTPStreamFactory sf;
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(sf.open(uri));
#else
std::unique_ptr<std::istream> pStr(sf.open(uri)); std::unique_ptr<std::istream> pStr(sf.open(uri));
#endif // POCO_ENABLE_CPP11
fail("no password provider - must throw"); fail("no password provider - must throw");
} }
catch (FTPException&) catch (FTPException&)

View File

@ -44,11 +44,7 @@ void HTTPStreamFactoryTest::testNoRedirect()
HTTPStreamFactory factory; HTTPStreamFactory factory;
URI uri("http://127.0.0.1/large"); URI uri("http://127.0.0.1/large");
uri.setPort(server.port()); uri.setPort(server.port());
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(factory.open(uri));
#else
std::unique_ptr<std::istream> pStr(factory.open(uri)); std::unique_ptr<std::istream> pStr(factory.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr; std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr); StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str() == HTTPTestServer::LARGE_BODY); assertTrue (ostr.str() == HTTPTestServer::LARGE_BODY);
@ -61,11 +57,7 @@ void HTTPStreamFactoryTest::testEmptyPath()
HTTPStreamFactory factory; HTTPStreamFactory factory;
URI uri("http://127.0.0.1"); URI uri("http://127.0.0.1");
uri.setPort(server.port()); uri.setPort(server.port());
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(factory.open(uri));
#else
std::unique_ptr<std::istream> pStr(factory.open(uri)); std::unique_ptr<std::istream> pStr(factory.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr; std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr); StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str() == HTTPTestServer::SMALL_BODY); assertTrue (ostr.str() == HTTPTestServer::SMALL_BODY);
@ -79,11 +71,7 @@ void HTTPStreamFactoryTest::testRedirect()
opener.registerStreamFactory("http", new HTTPStreamFactory); opener.registerStreamFactory("http", new HTTPStreamFactory);
URI uri("http://127.0.0.1/redirect"); URI uri("http://127.0.0.1/redirect");
uri.setPort(server.port()); uri.setPort(server.port());
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(opener.open(uri));
#else
std::unique_ptr<std::istream> pStr(opener.open(uri)); std::unique_ptr<std::istream> pStr(opener.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr; std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr); StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str() == HTTPTestServer::LARGE_BODY); assertTrue (ostr.str() == HTTPTestServer::LARGE_BODY);
@ -95,11 +83,7 @@ void HTTPStreamFactoryTest::testProxy()
HTTPTestServer server; HTTPTestServer server;
HTTPStreamFactory factory("127.0.0.1", server.port()); HTTPStreamFactory factory("127.0.0.1", server.port());
URI uri("http://www.somehost.com/large"); URI uri("http://www.somehost.com/large");
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(factory.open(uri));
#else
std::unique_ptr<std::istream> pStr(factory.open(uri)); std::unique_ptr<std::istream> pStr(factory.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr; std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr); StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str() == HTTPTestServer::LARGE_BODY); assertTrue (ostr.str() == HTTPTestServer::LARGE_BODY);

View File

@ -50,7 +50,7 @@ public:
{ {
Poco::Net::initializeSSL(); Poco::Net::initializeSSL();
} }
~SSLInitializer() ~SSLInitializer()
{ {
Poco::Net::uninitializeSSL(); Poco::Net::uninitializeSSL();
@ -64,7 +64,7 @@ int main(int argc, char** argv)
HTTPStreamFactory::registerFactory(); HTTPStreamFactory::registerFactory();
HTTPSStreamFactory::registerFactory(); HTTPSStreamFactory::registerFactory();
FTPStreamFactory::registerFactory(); FTPStreamFactory::registerFactory();
if (argc != 2) if (argc != 2)
{ {
Path p(argv[0]); Path p(argv[0]);
@ -74,7 +74,7 @@ int main(int argc, char** argv)
return 1; return 1;
} }
// Note: we must create the passphrase handler prior Context // Note: we must create the passphrase handler prior Context
SharedPtr<InvalidCertificateHandler> ptrCert = new ConsoleCertificateHandler(false); // ask the user via console SharedPtr<InvalidCertificateHandler> ptrCert = new ConsoleCertificateHandler(false); // ask the user via console
Context::Ptr ptrContext = new Context(Context::CLIENT_USE, "", "", "rootcert.pem", Context::VERIFY_RELAXED, 9, false, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); Context::Ptr ptrContext = new Context(Context::CLIENT_USE, "", "", "rootcert.pem", Context::VERIFY_RELAXED, 9, false, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
SSLManager::instance().initializeClient(0, ptrCert, ptrContext); SSLManager::instance().initializeClient(0, ptrCert, ptrContext);
@ -82,11 +82,7 @@ int main(int argc, char** argv)
try try
{ {
URI uri(argv[1]); URI uri(argv[1]);
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open(uri));
#else
std::unique_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open(uri)); std::unique_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open(uri));
#endif
StreamCopier::copyStream(*pStr.get(), std::cout); StreamCopier::copyStream(*pStr.get(), std::cout);
} }
catch (Exception& exc) catch (Exception& exc)
@ -94,6 +90,6 @@ int main(int argc, char** argv)
std::cerr << exc.displayText() << std::endl; std::cerr << exc.displayText() << std::endl;
return 1; return 1;
} }
return 0; return 0;
} }

View File

@ -47,11 +47,7 @@ void HTTPSStreamFactoryTest::testNoRedirect()
HTTPSStreamFactory factory; HTTPSStreamFactory factory;
URI uri("https://127.0.0.1/large"); URI uri("https://127.0.0.1/large");
uri.setPort(server.port()); uri.setPort(server.port());
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(factory.open(uri));
#else
std::unique_ptr<std::istream> pStr(factory.open(uri)); std::unique_ptr<std::istream> pStr(factory.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr; std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr); StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str() == HTTPSTestServer::LARGE_BODY); assertTrue (ostr.str() == HTTPSTestServer::LARGE_BODY);
@ -64,11 +60,7 @@ void HTTPSStreamFactoryTest::testEmptyPath()
HTTPSStreamFactory factory; HTTPSStreamFactory factory;
URI uri("https://127.0.0.1"); URI uri("https://127.0.0.1");
uri.setPort(server.port()); uri.setPort(server.port());
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(factory.open(uri));
#else
std::unique_ptr<std::istream> pStr(factory.open(uri)); std::unique_ptr<std::istream> pStr(factory.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr; std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr); StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str() == HTTPSTestServer::SMALL_BODY); assertTrue (ostr.str() == HTTPSTestServer::SMALL_BODY);
@ -81,11 +73,7 @@ void HTTPSStreamFactoryTest::testRedirect()
HTTPSStreamFactory factory; HTTPSStreamFactory factory;
URI uri("https://127.0.0.1/redirect"); URI uri("https://127.0.0.1/redirect");
uri.setPort(server.port()); uri.setPort(server.port());
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(factory.open(uri));
#else
std::unique_ptr<std::istream> pStr(factory.open(uri)); std::unique_ptr<std::istream> pStr(factory.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr; std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr); StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str() == HTTPSTestServer::LARGE_BODY); assertTrue (ostr.str() == HTTPSTestServer::LARGE_BODY);
@ -100,11 +88,7 @@ void HTTPSStreamFactoryTest::testProxy()
Application::instance().config().getInt("testsuite.proxy.port") Application::instance().config().getInt("testsuite.proxy.port")
); );
URI uri("https://secure.appinf.com/public/poco/NetSSL.txt"); URI uri("https://secure.appinf.com/public/poco/NetSSL.txt");
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(factory.open(uri));
#else
std::unique_ptr<std::istream> pStr(factory.open(uri)); std::unique_ptr<std::istream> pStr(factory.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr; std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr); StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str().length() > 0); assertTrue (ostr.str().length() > 0);

View File

@ -49,11 +49,7 @@ namespace
try try
{ {
WebSocket ws(request, response); WebSocket ws(request, response);
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<char> pBuffer(new char[_bufSize]);
#else
std::unique_ptr<char[]> pBuffer(new char[_bufSize]); std::unique_ptr<char[]> pBuffer(new char[_bufSize]);
#endif // POCO_ENABLE_CPP11
int flags; int flags;
int n; int n;
do do
@ -86,7 +82,7 @@ namespace
private: private:
std::size_t _bufSize; std::size_t _bufSize;
}; };
class WebSocketRequestHandlerFactory: public Poco::Net::HTTPRequestHandlerFactory class WebSocketRequestHandlerFactory: public Poco::Net::HTTPRequestHandlerFactory
{ {
public: public:
@ -120,9 +116,9 @@ void WebSocketTest::testWebSocket()
Poco::Net::SecureServerSocket ss(0); Poco::Net::SecureServerSocket ss(0);
Poco::Net::HTTPServer server(new WebSocketRequestHandlerFactory, ss, new Poco::Net::HTTPServerParams); Poco::Net::HTTPServer server(new WebSocketRequestHandlerFactory, ss, new Poco::Net::HTTPServerParams);
server.start(); server.start();
Poco::Thread::sleep(200); Poco::Thread::sleep(200);
HTTPSClientSession cs("127.0.0.1", ss.address().port()); HTTPSClientSession cs("127.0.0.1", ss.address().port());
HTTPRequest request(HTTPRequest::HTTP_GET, "/ws"); HTTPRequest request(HTTPRequest::HTTP_GET, "/ws");
HTTPResponse response; HTTPResponse response;
@ -163,19 +159,19 @@ void WebSocketTest::testWebSocket()
assertTrue (n == payload.size()); assertTrue (n == payload.size());
assertTrue (payload.compare(0, payload.size(), buffer, 0, n) == 0); assertTrue (payload.compare(0, payload.size(), buffer, 0, n) == 0);
assertTrue (flags == WebSocket::FRAME_TEXT); assertTrue (flags == WebSocket::FRAME_TEXT);
payload = "Hello, universe!"; payload = "Hello, universe!";
ws.sendFrame(payload.data(), (int) payload.size(), WebSocket::FRAME_BINARY); ws.sendFrame(payload.data(), (int) payload.size(), WebSocket::FRAME_BINARY);
n = ws.receiveFrame(buffer, sizeof(buffer), flags); n = ws.receiveFrame(buffer, sizeof(buffer), flags);
assertTrue (n == payload.size()); assertTrue (n == payload.size());
assertTrue (payload.compare(0, payload.size(), buffer, 0, n) == 0); assertTrue (payload.compare(0, payload.size(), buffer, 0, n) == 0);
assertTrue (flags == WebSocket::FRAME_BINARY); assertTrue (flags == WebSocket::FRAME_BINARY);
ws.shutdown(); ws.shutdown();
n = ws.receiveFrame(buffer, sizeof(buffer), flags); n = ws.receiveFrame(buffer, sizeof(buffer), flags);
assertTrue (n == 2); assertTrue (n == 2);
assertTrue ((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_CLOSE); assertTrue ((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_CLOSE);
server.stop(); server.stop();
} }
@ -189,7 +185,7 @@ void WebSocketTest::testWebSocketLarge()
server.start(); server.start();
Poco::Thread::sleep(200); Poco::Thread::sleep(200);
HTTPSClientSession cs("127.0.0.1", ss.address().port()); HTTPSClientSession cs("127.0.0.1", ss.address().port());
HTTPRequest request(HTTPRequest::HTTP_GET, "/ws"); HTTPRequest request(HTTPRequest::HTTP_GET, "/ws");
HTTPResponse response; HTTPResponse response;

View File

@ -48,7 +48,7 @@ public:
{ {
Poco::Net::initializeSSL(); Poco::Net::initializeSSL();
} }
~SSLInitializer() ~SSLInitializer()
{ {
Poco::Net::uninitializeSSL(); Poco::Net::uninitializeSSL();
@ -62,7 +62,7 @@ int main(int argc, char** argv)
HTTPStreamFactory::registerFactory(); HTTPStreamFactory::registerFactory();
HTTPSStreamFactory::registerFactory(); HTTPSStreamFactory::registerFactory();
FTPStreamFactory::registerFactory(); FTPStreamFactory::registerFactory();
if (argc != 2) if (argc != 2)
{ {
Path p(argv[0]); Path p(argv[0]);
@ -79,11 +79,7 @@ int main(int argc, char** argv)
try try
{ {
URI uri(argv[1]); URI uri(argv[1]);
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open(uri));
#else
std::unique_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open(uri)); std::unique_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open(uri));
#endif // POCO_ENABLE_CPP11
StreamCopier::copyStream(*pStr.get(), std::cout); StreamCopier::copyStream(*pStr.get(), std::cout);
} }
catch (Exception& exc) catch (Exception& exc)
@ -91,6 +87,6 @@ int main(int argc, char** argv)
std::cerr << exc.displayText() << std::endl; std::cerr << exc.displayText() << std::endl;
return 1; return 1;
} }
return 0; return 0;
} }

View File

@ -47,11 +47,7 @@ void HTTPSStreamFactoryTest::testNoRedirect()
HTTPSStreamFactory factory; HTTPSStreamFactory factory;
URI uri("https://127.0.0.1/large"); URI uri("https://127.0.0.1/large");
uri.setPort(server.port()); uri.setPort(server.port());
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(factory.open(uri));
#else
std::unique_ptr<std::istream> pStr(factory.open(uri)); std::unique_ptr<std::istream> pStr(factory.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr; std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr); StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str() == HTTPSTestServer::LARGE_BODY); assertTrue (ostr.str() == HTTPSTestServer::LARGE_BODY);
@ -64,11 +60,7 @@ void HTTPSStreamFactoryTest::testEmptyPath()
HTTPSStreamFactory factory; HTTPSStreamFactory factory;
URI uri("https://127.0.0.1"); URI uri("https://127.0.0.1");
uri.setPort(server.port()); uri.setPort(server.port());
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(factory.open(uri));
#else
std::unique_ptr<std::istream> pStr(factory.open(uri)); std::unique_ptr<std::istream> pStr(factory.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr; std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr); StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str() == HTTPSTestServer::SMALL_BODY); assertTrue (ostr.str() == HTTPSTestServer::SMALL_BODY);
@ -81,11 +73,7 @@ void HTTPSStreamFactoryTest::testRedirect()
HTTPSStreamFactory factory; HTTPSStreamFactory factory;
URI uri("https://127.0.0.1/redirect"); URI uri("https://127.0.0.1/redirect");
uri.setPort(server.port()); uri.setPort(server.port());
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(factory.open(uri));
#else
std::unique_ptr<std::istream> pStr(factory.open(uri)); std::unique_ptr<std::istream> pStr(factory.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr; std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr); StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str() == HTTPSTestServer::LARGE_BODY); assertTrue (ostr.str() == HTTPSTestServer::LARGE_BODY);
@ -96,15 +84,11 @@ void HTTPSStreamFactoryTest::testProxy()
{ {
HTTPSTestServer server; HTTPSTestServer server;
HTTPSStreamFactory factory( HTTPSStreamFactory factory(
Application::instance().config().getString("testsuite.proxy.host"), Application::instance().config().getString("testsuite.proxy.host"),
Application::instance().config().getInt("testsuite.proxy.port") Application::instance().config().getInt("testsuite.proxy.port")
); );
URI uri("https://secure.appinf.com/public/poco/NetSSL.txt"); URI uri("https://secure.appinf.com/public/poco/NetSSL.txt");
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(factory.open(uri));
#else
std::unique_ptr<std::istream> pStr(factory.open(uri)); std::unique_ptr<std::istream> pStr(factory.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr; std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr); StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str().length() > 0); assertTrue (ostr.str().length() > 0);

View File

@ -295,11 +295,7 @@ protected:
p.setBaseName(clazz); p.setBaseName(clazz);
} }
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<CodeWriter> pCodeWriter(createCodeWriter(page, clazz));
#else
std::unique_ptr<CodeWriter> pCodeWriter(createCodeWriter(page, clazz)); std::unique_ptr<CodeWriter> pCodeWriter(createCodeWriter(page, clazz));
#endif
if (!_outputDir.empty()) if (!_outputDir.empty())
{ {

View File

@ -303,11 +303,7 @@ protected:
void parse(const std::string& file) void parse(const std::string& file)
{ {
logger().information("Preprocessing " + file); logger().information("Preprocessing " + file);
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<Preprocessor> pPreProc(preprocess(file));
#else
std::unique_ptr<Preprocessor> pPreProc(preprocess(file)); std::unique_ptr<Preprocessor> pPreProc(preprocess(file));
#endif // POCO_ENABLE_CPP11
logger().information("Parsing " + file); logger().information("Parsing " + file);
if (pPreProc->stream().good()) if (pPreProc->stream().good())
{ {