Mercurial > prosody-modules
comparison mod_websocket/mod_websocket.lua @ 905:eae665bc2122
mod_websocket: Fix require to work with lua-bitop (Thanks István and Zash)
| author | Florian Zeitz <florob@babelmonkeys.de> |
|---|---|
| date | Sun, 10 Feb 2013 20:12:42 +0100 |
| parents | 1f4d77104da5 |
| children | ec4c6e8f277d |
comparison
equal
deleted
inserted
replaced
| 904:7648ee2d59d1 | 905:eae665bc2122 |
|---|---|
| 11 local sha1 = require "util.hashes".sha1; | 11 local sha1 = require "util.hashes".sha1; |
| 12 local base64 = require "util.encodings".base64.encode; | 12 local base64 = require "util.encodings".base64.encode; |
| 13 local softreq = require "util.dependencies".softreq; | 13 local softreq = require "util.dependencies".softreq; |
| 14 local portmanager = require "core.portmanager"; | 14 local portmanager = require "core.portmanager"; |
| 15 | 15 |
| 16 local bit = softreq"bit" or softreq"bit32" or module:log("error", "No bit module found. Either LuaJIT 2 or Lua 5.2 is required"); | 16 local bit; |
| 17 pcall(function() bit = require"bit"; end); | |
| 18 bit = bit or softreq"bit32" | |
| 19 if not bit then module:log("error", "No bit module found. Either LuaJIT 2, lua-bitop or Lua 5.2 is required"); end | |
| 17 local band = bit.band; | 20 local band = bit.band; |
| 18 local bxor = bit.bxor; | 21 local bxor = bit.bxor; |
| 19 | 22 |
| 20 local cross_domain = module:get_option("cross_domain_websocket"); | 23 local cross_domain = module:get_option("cross_domain_websocket"); |
| 21 if cross_domain then | 24 if cross_domain then |
