💾 Archived View for gemini.conman.org › extensions › GLV-1 › handlers › redirhell.lua captured on 2020-10-31 at 23:59:59.

View Raw

More Information

➡️ Next capture (2021-12-03)

-=-=-=-=-=-=-

-- ************************************************************************
--
--    Redirection Hell Torture Test
--    Copyright 2019 by Sean Conner.  All Rights Reserved.
--
--    This program is free software: you can redistribute it and/or modify
--    it under the terms of the GNU General Public License as published by
--    the Free Software Foundation, either version 3 of the License, or
--    (at your option) any later version.
--
--    This program is distributed in the hope that it will be useful,
--    but WITHOUT ANY WARRANTY; without even the implied warranty of
--    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--    GNU General Public License for more details.
--
--    You should have received a copy of the GNU General Public License
--    along with this program.  If not, see <http://www.gnu.org/licenses/>.
--
--    Comments, questions and criticisms can be sent to: sean@conman.org
--
-- ************************************************************************
-- luacheck: globals handler
-- luacheck: ignore 611

                 require "org.conman.math".randomseed()
local uuid     = require "org.conman.uuid"
local uurl     = require "GLV-1.url-util"
local math     = require "math"
local tostring = tostring

_ENV = {}

function handler(conf,auth,loc)
  local path = { path = tostring(uuid(uuid.URL,auth._remote .. auth._port)) }
  
  if conf.redirect then
    return conf.redirect,uurl.toa(uurl.merge(loc,path)),""
  else
    return math.random(30,31),uurl.toa(uurl.merge(loc,path)),""
  end
end

return _ENV