Feature #1596 » SslPasswordCallback.patch
src/Wt/WServer | ||
---|---|---|
WT_API void setCatchSignals(bool catchSignals);
|
||
WT_API static WServer *instance_;
|
||
WT_API boost::function<std::string (std::size_t max_length)> sslPasswordCallback_;
|
||
};
|
||
}
|
src/http/Configuration.h | ||
---|---|---|
::int64_t maxMemoryRequestSize() const { return maxMemoryRequestSize_; }
|
||
// ssl Password callback is not configurable from a file but we store it
|
||
// here because it's used in the Server constructor (inside start())
|
||
void setSslPasswordCallback(
|
||
boost::function<std::string (std::size_t max_length)> cb)
|
||
{ sslPasswordCallback_ = cb; }
|
||
boost::function<std::string (std::size_t max_length)> sslPasswordCallback()
|
||
{ return sslPasswordCallback_; }
|
||
bool hasSslPasswordCallback()
|
||
{ return sslPasswordCallback_; }
|
||
private:
|
||
Wt::WLogger& logger_;
|
||
bool silent_;
|
||
... | ... | |
::int64_t maxMemoryRequestSize_;
|
||
boost::function<std::string (std::size_t max_length)> sslPasswordCallback_;
|
||
void createOptions(po::options_description& options);
|
||
void readOptions(const po::variables_map& vm);
|
||
src/http/Server.C | ||
---|---|---|
LOG_INFO_S(&wt_, "starting server: https://" <<
|
||
config_.httpsAddress() << ":" << config_.httpsPort());
|
||
if (config_.hasSslPasswordCallback())
|
||
ssl_context_.set_password_callback(config_.sslPasswordCallback());
|
||
int sslOptions = asio::ssl::context::default_workarounds
|
||
| asio::ssl::context::no_sslv2
|
||
| asio::ssl::context::single_dh_use;
|
||
... | ... | |
return tcp_acceptor_.local_endpoint().port();
|
||
}
|
||
void Server::setSslPasswordCallback(
|
||
boost::function<std::string (std::size_t max_length)> cb)
|
||
{
|
||
#ifdef HTTP_WITH_SSL
|
||
ssl_context_.set_password_callback(boost::bind(cb, _1));
|
||
#endif // HTTP_WITH_SSL
|
||
}
|
||
void Server::startAccept()
|
||
{
|
||
/*
|
src/http/Server.h | ||
---|---|---|
/// Returns the http port number.
|
||
int httpPort() const;
|
||
// Sets callback for SSL passwords
|
||
void setSslPasswordCallback(boost::function<std::string (std::size_t max_length)> cb);
|
||
Wt::WebController *controller();
|
||
const Configuration &configuration() { return config_; }
|
src/http/WServer.C | ||
---|---|---|
impl_->serverConfiguration_ = new http::server::Configuration(logger());
|
||
impl_->serverConfiguration_->setSslPasswordCallback(sslPasswordCallback_);
|
||
if (argc != 0)
|
||
impl_->serverConfiguration_->setOptions(argc, argv,
|
||
serverConfigurationFile);
|
||
... | ... | |
void WServer::setSslPasswordCallback(
|
||
boost::function<std::string (std::size_t max_length)> cb)
|
||
{
|
||
impl_->server_->setSslPasswordCallback(cb);
|
||
sslPasswordCallback_ = cb;
|
||
}
|
||
int WRun(int argc, char *argv[], ApplicationCreator createApplication)
|