Skip to content

Instantly share code, notes, and snippets.

@dvv
Created October 21, 2011 15:48
Show Gist options
  • Save dvv/1304168 to your computer and use it in GitHub Desktop.
Save dvv/1304168 to your computer and use it in GitHub Desktop.
diff --git a/lib/emitter.lua b/lib/emitter.lua
index 4f77579..37778cb 100644
--- a/lib/emitter.lua
+++ b/lib/emitter.lua
@@ -58,7 +58,7 @@ function emitter_prototype:remove_listener(name, callback)
if not handlers then return end
local handlers_for_type = rawget(handlers, name)
if not handlers_for_type then return end
- handlers_for_type[name][callback] = nil
+ handlers_for_type[callback] = nil
end
local emitter_meta = {__index=emitter_prototype}
diff --git a/lib/luvit.lua b/lib/luvit.lua
index 134d983..cd29381 100644
--- a/lib/luvit.lua
+++ b/lib/luvit.lua
@@ -161,6 +161,9 @@ end
-- Make relative requires be relative to the file that required them
local real_require = require
function require(path)
+ if path:sub(-1) == "/" then
+ path = path .. "index"
+ end
if path:sub(1,1) == "." then
local source = Debug.getinfo(2, "S").source
if source:sub(1,1) == "@" then
diff --git a/lib/response.lua b/lib/response.lua
index d9b1178..a164a44 100644
--- a/lib/response.lua
+++ b/lib/response.lua
@@ -120,14 +120,14 @@ function Response.prototype:write_continue()
self.userdata:write('HTTP/1.1 100 Continue\r\n\r\n')
end
-function Response.prototype:write(chunk)
+function Response.prototype:write(chunk, callback)
local userdata = self.userdata
if self.chunked then
userdata:write(string_format("%x\r\n", #chunk))
userdata:write(chunk)
- return userdata:write("\r\n")
+ return userdata:write("\r\n", callback)
end
- return userdata:write(chunk)
+ return userdata:write(chunk, callback)
end
function Response.prototype:finish(chunk)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment