added support for ssl session caching

This commit is contained in:
roberto@precise64
2012-05-20 20:31:20 +02:00
parent 85fdfdd81f
commit 17254ee863
3 changed files with 13 additions and 3 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ void uwsgi_opt_https(char *opt, char *value, void *cr) {
}
// initialize ssl context
ugs->ctx = uwsgi_ssl_new_server_context(crt, key, ciphers);
ugs->ctx = uwsgi_ssl_new_server_context(uwsgi_concat3(ucr->short_name, "-", ugs->name),crt, key, ciphers);
// the clients must be put in non-blocking mode
ugs->nb = 1;
// set the ssl mode
+11 -1
View File
@@ -4319,7 +4319,7 @@ void uwsgi_ssl_info_cb(SSL const *ssl, int where, int ret) {
}
}
SSL_CTX *uwsgi_ssl_new_server_context(char *crt, char *key, char *ciphers) {
SSL_CTX *uwsgi_ssl_new_server_context(char *name, char *crt, char *key, char *ciphers) {
SSL_CTX *ctx = SSL_CTX_new(SSLv23_server_method());
if (!ctx) {
@@ -4381,6 +4381,16 @@ SSL_CTX *uwsgi_ssl_new_server_context(char *crt, char *key, char *ciphers) {
SSL_CTX_set_info_callback(ctx, uwsgi_ssl_info_cb);
if (name) {
SSL_CTX_set_session_id_context(ctx, (unsigned char *)name, strlen(name));
SSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_SERVER);
#ifdef UWSGI_DEBUG
uwsgi_log("[uwsgi-ssl] initialized ssl session cache: %s\n", name);
#endif
//SSL_CTX_set_timeout
//SSL_CTX_sess_set_cache_size
}
return ctx;
}
+1 -1
View File
@@ -2884,7 +2884,7 @@ char *uwsgi_substitute(char *, char *, char *);
#include "openssl/conf.h"
#include "openssl/ssl.h"
void uwsgi_ssl_init(void);
SSL_CTX *uwsgi_ssl_new_server_context(char *, char *, char *);
SSL_CTX *uwsgi_ssl_new_server_context(char *, char *, char *, char *);
#endif
#ifdef UWSGI_AS_SHARED_LIBRARY