Mercurial > prosody-modules
diff mod_auth_http_async/mod_auth_http_async.lua @ 2630:96eb1c4f9ff7
mod_auth_http_async: Use "net.http" for async case.
author | JC Brand <jc@opkode.com> |
---|---|
date | Tue, 21 Mar 2017 09:31:13 +0000 |
parents | a11568bfaf4c |
children | 1d139e33c502 |
line wrap: on
line diff
--- a/mod_auth_http_async/mod_auth_http_async.lua Tue Mar 21 09:14:03 2017 +0000 +++ b/mod_auth_http_async/mod_auth_http_async.lua Tue Mar 21 09:31:13 2017 +0000 @@ -8,8 +8,6 @@ -- local new_sasl = require "util.sasl".new; -local http = require "socket.http"; -local https = require "ssl.https"; local base64 = require "util.encodings".base64.encode; local have_async, async = pcall(require, "util.async"); @@ -30,6 +28,7 @@ end local function async_http_auth(url, username, password) + local http = require "net.http"; local wait, done = async.waiter(); local content, code, request, response; local ex = { @@ -51,6 +50,8 @@ end local function sync_http_auth(url) + local http = require "socket.http"; + local https = require "ssl.https"; local request; if string.sub(url, 1, string.len('https')) == 'https' then request = https.request;