Skip to content

Instantly share code, notes, and snippets.

@rphillips
Created June 21, 2012 04:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rphillips/bc3c536d72f147f41c27 to your computer and use it in GitHub Desktop.
Save rphillips/bc3c536d72f147f41c27 to your computer and use it in GitHub Desktop.
diff --git a/lib/luvit/tls.lua b/lib/luvit/tls.lua
index fd2c2d5..8ae112d 100644
--- a/lib/luvit/tls.lua
+++ b/lib/luvit/tls.lua
@@ -32,7 +32,7 @@ local string = require('string')
local fmt = string.format
local END_OF_FILE = 42
-local DEBUG = false
+local DEBUG = true
local function dbg(format, ...)
if DEBUG == true then
@@ -133,8 +133,9 @@ end
function CryptoStream:write(data, ...)
dbg('CryptoStream:write')
+ local len = data.length or #data
- if #data == 0 then
+ if len == 0 then
return
end
@@ -154,7 +155,7 @@ function CryptoStream:write(data, ...)
callback = args[1]
end
- table.insert(self._pending, data)
+ table.insert(self._pending, tostring(data))
table.insert(self._pendingCallbacks, callback)
self._pendingBytes = self._pendingBytes + #data
self.pair._writeCalled = true
@@ -835,7 +836,7 @@ function connect(...)
end
local socket = options.socket or Socket:new()
-
+
if options.context then
sslcontext = createCredentials(options, options.context)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment