Do not bother initializing OpenSSL if only listening locally

This commit is contained in:
Pierre Pronchery 2012-09-22 20:54:07 +00:00
parent bcec18dfc9
commit 7f8c7de6ba

View File

@ -509,18 +509,21 @@ AppServer * appserver_new_event(char const * app, int options, Event * event)
# ifdef DEBUG # ifdef DEBUG
fprintf(stderr, "DEBUG: Using certificate \"%s\"\n", crt); fprintf(stderr, "DEBUG: Using certificate \"%s\"\n", crt);
# endif # endif
if((appserver->ssl_ctx = SSL_CTX_new(SSLv3_server_method())) == NULL if(!(options & ASO_LOCAL))
|| SSL_CTX_set_cipher_list(appserver->ssl_ctx, if((appserver->ssl_ctx = SSL_CTX_new(SSLv3_server_method())) == NULL
SSL_DEFAULT_CIPHER_LIST) != 1 || SSL_CTX_set_cipher_list(appserver->ssl_ctx,
|| SSL_CTX_use_certificate_file(appserver->ssl_ctx, crt, SSL_DEFAULT_CIPHER_LIST) != 1
SSL_FILETYPE_PEM) == 0 || SSL_CTX_use_certificate_file(
|| SSL_CTX_use_PrivateKey_file(appserver->ssl_ctx, crt, appserver->ssl_ctx, crt,
SSL_FILETYPE_PEM) == 0) SSL_FILETYPE_PEM) == 0
{ || SSL_CTX_use_PrivateKey_file(
error_set_code(1, "%s", _appserver_error_ssl()); appserver->ssl_ctx, crt,
appserver_delete(appserver); SSL_FILETYPE_PEM) == 0)
return NULL; {
} error_set_code(1, "%s", _appserver_error_ssl());
appserver_delete(appserver);
return NULL;
}
#endif #endif
appserver->current = NULL; appserver->current = NULL;
return appserver; return appserver;