diff options
| -rw-r--r-- | src/openssl.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/openssl.c b/src/openssl.c index 38c9888..a92df1a 100644 --- a/src/openssl.c +++ b/src/openssl.c | |||
| @@ -7903,7 +7903,13 @@ static SSL *ssl_push(lua_State *L, SSL *ssl) { | |||
| 7903 | } /* ssl_push() */ | 7903 | } /* ssl_push() */ |
| 7904 | 7904 | ||
| 7905 | static int ssl_new(lua_State *L) { | 7905 | static int ssl_new(lua_State *L) { |
| 7906 | lua_pushnil(L); | 7906 | SSL_CTX *ctx = checksimple(L, 1, SSL_CTX_CLASS); |
| 7907 | SSL **ud = prepsimple(L, SSL_CLASS); | ||
| 7908 | |||
| 7909 | *ud = SSL_new(ctx); | ||
| 7910 | |||
| 7911 | if (!*ud) | ||
| 7912 | return auxL_error(L, auxL_EOPENSSL, "ssl.new"); | ||
| 7907 | 7913 | ||
| 7908 | return 1; | 7914 | return 1; |
| 7909 | } /* ssl_new() */ | 7915 | } /* ssl_new() */ |
| @@ -8008,7 +8014,7 @@ static int ssl_getHostName(lua_State *L) { | |||
| 8008 | 8014 | ||
| 8009 | static int ssl_setHostName(lua_State *L) { | 8015 | static int ssl_setHostName(lua_State *L) { |
| 8010 | SSL *ssl = checksimple(L, 1, SSL_CLASS); | 8016 | SSL *ssl = checksimple(L, 1, SSL_CLASS); |
| 8011 | const char *host = luaL_checkstring(L, 2); | 8017 | const char *host = luaL_optstring(L, 2, NULL); |
| 8012 | 8018 | ||
| 8013 | if (!SSL_set_tlsext_host_name(ssl, host)) | 8019 | if (!SSL_set_tlsext_host_name(ssl, host)) |
| 8014 | return auxL_error(L, auxL_EOPENSSL, "ssl:setHostName"); | 8020 | return auxL_error(L, auxL_EOPENSSL, "ssl:setHostName"); |
