diff --git a/src/lib/socket.c b/src/lib/socket.c index 6424d0c..12a6b1d 100644 --- a/src/lib/socket.c +++ b/src/lib/socket.c @@ -2381,6 +2381,13 @@ static int bio_read(BIO *bio, char *dst, int lim) { memcpy(dst, so->bio.ahead.p, count); so->bio.ahead.p += count; + if (so->bio.ahead.p == so->bio.ahead.pe) { + free(so->bio.ahead.data); + so->bio.ahead.data = NULL; + so->bio.ahead.p = NULL; + so->bio.ahead.pe = NULL; + } + return count; } diff --git a/src/socket.lua b/src/socket.lua index 12cfc86..07cd9cd 100644 --- a/src/socket.lua +++ b/src/socket.lua @@ -312,19 +312,10 @@ end) -- -- Smarter socket:checktls -- -local havessl, whynossl - local _checktls; _checktls = socket.interpose("checktls", function(self) + local havessl, whynossl = pcall(require, "openssl.ssl") if not havessl then - if havessl == false then - return nil, whynossl - end - - local havessl, whynossl = pcall(require, "openssl.ssl") - - if not havessl then - return nil, whynossl - end + return nil, whynossl end return _checktls(self)