finally get rid of std::auto_ptr

This commit is contained in:
Günter Obiltschnig
2019-12-15 09:40:40 +01:00
parent 56fe4eaf97
commit 9c197e0ed1
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);
ApacheApplication& app(ApacheApplication::instance());
try
{
// ensure application is ready
app.setup();
// if the ApacheRequestHandler declines handling - we stop
// request handling here and let other modules do their job!
if (!app.factory().mustHandle(r->uri))
return DECLINED;
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;
// 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;
apr_port_t clientPort = r->connection->client_addr->port;
#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(
&rec,
r->connection->local_ip,
@@ -217,22 +207,17 @@ extern "C" int ApacheConnector_handler(request_rec *r)
clientPort));
std::unique_ptr<ApacheServerResponse> pResponse(new ApacheServerResponse(pRequest.get()));
#endif // POCO_ENABLE_CPP11
// add header information to request
rec.copyHeaders(*pRequest);
try
{
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<HTTPRequestHandler> pHandler(app.factory().createRequestHandler(*pRequest));
#else
std::unique_ptr<HTTPRequestHandler> pHandler(app.factory().createRequestHandler(*pRequest));
#endif // POCO_ENABLE_CPP11
if (pHandler.get())
{
{
pHandler->handleRequest(*pRequest, *pResponse);
}
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(
"AddPocoRequestHandler",
reinterpret_cast<cmd_func>(ApacheConnector_uris),
"AddPocoRequestHandler",
reinterpret_cast<cmd_func>(ApacheConnector_uris),
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."),
AP_INIT_RAW_ARGS(
"AddPocoConfig",
reinterpret_cast<cmd_func>(ApacheConnector_config),
"AddPocoConfig",
reinterpret_cast<cmd_func>(ApacheConnector_config),
NULL,
RSRC_CONF,
RSRC_CONF,
"Path of the POCO configuration file."),
{ NULL }
};
module AP_MODULE_DECLARE_DATA poco_module =
module AP_MODULE_DECLARE_DATA poco_module =
{
STANDARD20_MODULE_STUFF,
NULL,