summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/openssl.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/openssl.c b/src/openssl.c
index 2b0cb88..2dee037 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -33,7 +33,7 @@
33#include <math.h> /* INFINITY fabs(3) floor(3) frexp(3) fmod(3) round(3) isfinite(3) */ 33#include <math.h> /* INFINITY fabs(3) floor(3) frexp(3) fmod(3) round(3) isfinite(3) */
34#include <time.h> /* struct tm time_t strptime(3) time(2) */ 34#include <time.h> /* struct tm time_t strptime(3) time(2) */
35#include <ctype.h> /* tolower(3) */ 35#include <ctype.h> /* tolower(3) */
36#include <errno.h> /* errno */ 36#include <errno.h> /* ENOMEM errno */
37 37
38#include <sys/types.h> /* ssize_t pid_t */ 38#include <sys/types.h> /* ssize_t pid_t */
39#if !defined __sun && !defined _AIX 39#if !defined __sun && !defined _AIX
@@ -4554,9 +4554,15 @@ static int sx_setAlpnProtos(lua_State *L) {
4554done: 4554done:
4555 luaL_pushresult(&B); 4555 luaL_pushresult(&B);
4556 tmp = lua_tolstring(L, -1, &len); 4556 tmp = lua_tolstring(L, -1, &len);
4557
4558 /* OpenSSL 1.0.2 doesn't update the error stack on failure. */
4559 ERR_clear_error();
4557 if (0 != SSL_CTX_set_alpn_protos(ctx, (const unsigned char*)tmp, len)) { 4560 if (0 != SSL_CTX_set_alpn_protos(ctx, (const unsigned char*)tmp, len)) {
4558 lua_pushnil(L); 4561 if (!ERR_peek_error()) {
4559 return 1; 4562 return luaL_error(L, "unable to set ALPN protocols: %s", xstrerror(ENOMEM));
4563 } else {
4564 return throwssl(L, "ssl.context:setAlpnProtos");
4565 }
4560 } 4566 }
4561 4567
4562 lua_pushboolean(L, 1); 4568 lua_pushboolean(L, 1);