#623 Problem with HTTPS server

Feature_Request
open
nobody
None
1
2014-09-05
2014-04-17
Artem
No

So I'm trying to create simple HTTPS server. I use code from sample like that
class HTTPSTimeServer: public Poco::Util::ServerApplication
{
public:
HTTPSTimeServer(): _helpRequested(false)
{
Poco::Net::initializeSSL();
}

    ~HTTPSTimeServer()
    {
        Poco::Net::uninitializeSSL();
    }
        ...
};

But if I create and destroy HTTPSTimeServer twice, I get exception "error:0906A068:PEM routines:PEM_do_header:bad password read" when I run it in the second time for the same private key file.
HTTPSTimeServer* app = new HTTPSTimeServer();
app->run(argc, argv);
delete app;

  HTTPSTimeServer* app1 = new HTTPSTimeServer();
  app1->run(argc, argv); // error:0906A068
  delete app1;

I'm not sure but probably that is because SSLManager::shutdown() doesn't clean all fields correctly. I can solve problem by invoking Poco::Net::initializeSSL() only once in program but there is in documentation for Poco::Net::initializeSSL() "Can be called multiple times;".
So I think that it is some kind of bug probably.

Discussion