diff -pruN 5.2~alpha2-2/Makefile 6.0.2-2/Makefile
--- 5.2~alpha2-2/Makefile	2013-08-09 13:09:14.000000000 +0000
+++ 6.0.2-2/Makefile	2020-07-04 15:27:37.000000000 +0000
@@ -4,7 +4,7 @@
 PREFIX= /usr/local
 
 # System's lua directory (where Lua libraries are installed)
-LUA_DIR= $(PREFIX)/share/lua/5.1
+LUA_DIR= $(PREFIX)/share/lua/5.2
 
 CGILUA_DIR= $(LUA_DIR)/cgilua
 CGILUA_LUAS= src/cgilua/authentication.lua src/cgilua/cookies.lua src/cgilua/dispatcher.lua src/cgilua/loader.lua src/cgilua/lp.lua src/cgilua/mime.lua src/cgilua/post.lua src/cgilua/readuntil.lua src/cgilua/serialize.lua src/cgilua/session.lua src/cgilua/urlcode.lua
diff -pruN 5.2~alpha2-2/README 6.0.2-2/README
--- 5.2~alpha2-2/README	2013-08-09 13:09:14.000000000 +0000
+++ 6.0.2-2/README	1970-01-01 00:00:00.000000000 +0000
@@ -1,125 +0,0 @@
-CGILua 5.1.4
-http://keplerproject.org/cgilua
-
-Overview
-
-CGILua is a tool for creating dynamic Web pages and manipulating input data
-from Web forms. CGILua allows the separation of logic and data handling from
-the generation of pages, making it easy to develop web applications with Lua.
-
-One of advantages of CGILua is its abstraction of the underlying Web server.
-CGILua can be used with a variety of Web servers and, for each server, with
-different launchers. A launcher is responsible for the interaction of CGILua
-and the Web server, for example using ISAPI on IIS or mod_lua on Apache.
-The reference implementation of CGILua launchers is Kepler. 
-
-CGILua is free software and uses the same license as Lua 5.1.
-
-You can also install CGILua using LuaRocks:
-luarocks install cgilua
-
-History
-
-Version 5.1.4 [22/Mar/2010]
-
-	* fixed file upload reentrancy
-	* new launchers for cgilua that do not depend on kepler_init
-        * Correction on mkurlpath
-
-Version 5.1.3 [9/Mar/2009]
-
-        * Strips utf-8 BOM from templates in lp.include
-        * Fixed reentrancy bug
-        * Fixed reset of cgilua.urlpath
-
-Version 5.1.2 [19/May/2008]
-
-        * Added the cgilua.authentication module
-        * cgilua.print now separates arguments with tabs, like Lua print
-        * Now print and write are aliases to cgilua.print and cgilua.put.
-        * Now strips an eventual #! from top of Lua Pages files
-        * CGILua can now process sequential requests in the same Lua state
-        * Better error handling. Wraps error message in valid HTML
-        * Bug fixed: CGILua was ignoring CGILUA_TMP in Windows
-        * Corrected the URL handling for the dispatcher (bug found by Ronaldo Sugii)
-        * Better URL handling for different locales
-        * Handling multiple values in the generated URL (patch by Matt Campbell)
-        * Fixed file handle leak in loader.lua
-        * Fixed bug [#2630] - Including new files (bug found by Bruno Massa)
-
-Version 5.1.1 [21/Nov/2007]
-
-        * Changed the security policy for scripts. Now scripts have access to all Lua globals, including the debug and os packages. It is up to the application developer to choose what policy to use
-        * If you are using Kepler, it is strongly suggested that you replace your previous CGILua config.lua file with the new one installed by Kepler and then merge the differences
-        * Added the cgilua.dispatcher module
-        * Added default handlers for a set of MIME types. The default handlers return only the content-type and conten-lenght headers for the files.
-        * Added functions cgilua.splitonfirst and cgilua.splitonlast
-        * Added functions cgilua.tmpfile and cgilua.tmpname
-        * Changed the use of "/test" for the session temporary directory checking (bug found by Yuri Takhteyev)
-        * Corrected the use of cgilua.QUERY in the session handling (bug found by Jim Madsen)
-        * Better handling of "application/xml" POST content types (patch by Ignacio Burgueño)
-        * Fixed Bug [#1910] - Bug in byte accounting in post.lua (found by Greg Bell)
-
-Version 5.1.0 [23/Aug/2007]
-
-        * Uses Lua 5.1
-        * Added function cgilua.print (that uses tostring on its parameters)
-        * Added a generic dispatcher and the concept of CGILua Apps
-        * Replaced the cgi table used until CGILua 5.0 by two others cgilua.QUERY and cgilua.POST)
-        * Added fake "package" table to enable the user/programmer to create modules with global visibility
-        * Bug fix: return of HTTP status code
-        * Bug fix: close method was recreating the session file
-        * Correcting how LP handles strings with CR characters (Lua 5.0 would not mind, but Lua 5.1 does)
-        * Fixed a bug with lighttpd
-
-Version 5.0.1 [20/Sep/2006]
-
-        * Uses Compat-5.1 Release 5.
-        * Caches Lua Pages template strings.
-        * New configuration examples.
-        * Improvements in the Session library.
-        * Removed the debug package from the user scripts environment.
-        * POST handling bug fixes (related to the text/plain content type).
-
-Version 5.0 [23/Jul/2005]
-
-        * CGILua distribution includes now only the Lua files, the launchers have been moved to Kepler.
-        * The Stable library is now distributed with VEnv.
-        * Fixed a file upload bug in the CGI and Xavante launchers.
-        * cgilua.lp.include() now accepts an environment to run the preprocessed file in it.
-
-Version 5.0 beta 2 [23/Dec/2004]
-
-        * Distribution bug fix: stable.lua was missing
-
-Version 5.0 beta [15/Dec/2004]
-
-        * New ISAPI and Servlet Launchers.
-        * New Error Handling features.
-        * New persistent data feature (Stable).
-        * Uses the package model for Lua 5.1.
-        * Simpler User Session API.
-        * Small bug corrections
-
-Version 5.0 alpha 3 [8/Jun/2004]
-Version 5.0 alpha [21/Apr/2004]
-
-Incompatibility with previous CGILua versions (5.0, 4.0 and 3.x)
-
-    * CGILua 5.1 uses Lua 5.1.
-    * The cgi table is now deprecated. See Receiving parameters for a more detailed explanation.
-    * The template tags have changed. See Lua pages for a more detailed explanation.
-    * The use of getenv calls to obtain CGI variables should be replaced by cgilua.servervariable calls.
-
-Credits
-
-CGILua 5.1
-    CGILua 5.1 is being maintained by André Carregal and Tomás Guisasola with contributions from Fábio Mascarenhas and others from the Kepler mailing list. 
-CGILua 5.0
-    CGILua 5.0 was completely redesigned by Roberto Ierusalimschy, André Carregal and Tomás Guisasola as part of the Kepler Project. The implementation is compatible with Lua 5.0 and was coded by Tomás Guisasola with invaluable contributions by Ana Lúcia de Moura, Fábio Mascarenhas and Danilo Tuler. CGILua 5.0 development was sponsored by Fábrica Digital, FINEP and CNPq.
-CGILua 4.0
-    Ana Lúcia de Moura adapted CGILua 3.2 to Lua 4.0, reimplemented some code and added a few improvements but this version was not officially distributed.
-CGILua 3.x
-    CGILua was born as the evolution of an early system developed by Renato Ferreira Borges and André Clínio at TeCGraf. At the time (circa 1995) there were no CGI tools available and everything was done with shell scripts!
-    However, the main contribution to CGILua 3 was done by Anna Hester, who consolidated the whole tool and developed a consistent distribution with versions 3.1 and 3.2 (the number was an effort to follow Lua version numbers). This version was widely used on a great variety of systems.
-
diff -pruN 5.2~alpha2-2/README.md 6.0.2-2/README.md
--- 5.2~alpha2-2/README.md	1970-01-01 00:00:00.000000000 +0000
+++ 6.0.2-2/README.md	2020-07-04 15:27:37.000000000 +0000
@@ -0,0 +1,139 @@
+# CGILua 5.2.1
+
+http://keplerproject.github.io/cgilua/
+
+## Overview
+
+CGILua is a tool for creating dynamic Web pages and manipulating input data
+from Web forms. CGILua allows the separation of logic and data handling from
+the generation of pages, making it easy to develop web applications with Lua.
+
+One of advantages of CGILua is its abstraction of the underlying Web server.
+CGILua can be used with a variety of Web servers and, for each server, with
+different launchers. A launcher is responsible for the interaction of CGILua
+and the Web server, for example using ISAPI on IIS or mod_lua on Apache.
+The reference implementation of CGILua launchers is Kepler. 
+
+CGILua is free software and uses the same license as Lua 5.x (MIT).
+
+You can install CGILua using [LuaRocks](https://github.com/keplerproject/luarocks):
+
+```
+luarocks install cgilua
+```
+
+## History
+
+Version 5.2.1 [22/Apr/2015]
+
+* Uses Lua 5.2
+
+Version 5.1.4 [22/Mar/2010]
+
+* fixed file upload reentrancy
+* new launchers for cgilua that do not depend on kepler_init
+* Correction on mkurlpath
+
+Version 5.1.3 [9/Mar/2009]
+
+* Strips utf-8 BOM from templates in lp.include
+* Fixed reentrancy bug
+* Fixed reset of cgilua.urlpath
+
+Version 5.1.2 [19/May/2008]
+
+* Added the cgilua.authentication module
+* cgilua.print now separates arguments with tabs, like Lua print
+* Now print and write are aliases to cgilua.print and cgilua.put.
+* Now strips an eventual #! from top of Lua Pages files
+* CGILua can now process sequential requests in the same Lua state
+* Better error handling. Wraps error message in valid HTML
+* Bug fixed: CGILua was ignoring CGILUA_TMP in Windows
+* Corrected the URL handling for the dispatcher (bug found by Ronaldo Sugii)
+* Better URL handling for different locales
+* Handling multiple values in the generated URL (patch by Matt Campbell)
+* Fixed file handle leak in loader.lua
+* Fixed bug [#2630] - Including new files (bug found by Bruno Massa)
+
+Version 5.1.1 [21/Nov/2007]
+
+* Changed the security policy for scripts. Now scripts have access to all Lua globals, including the debug and os packages. It is up to the application developer to choose what policy to use
+* If you are using Kepler, it is strongly suggested that you replace your previous CGILua config.lua file with the new one installed by Kepler and then merge the differences
+* Added the cgilua.dispatcher module
+* Added default handlers for a set of MIME types. The default handlers return only the content-type and content-lenght headers for the files.
+* Added functions cgilua.splitonfirst and cgilua.splitonlast
+* Added functions cgilua.tmpfile and cgilua.tmpname
+* Changed the use of "/test" for the session temporary directory checking (bug found by Yuri Takhteyev)
+* Corrected the use of cgilua.QUERY in the session handling (bug found by Jim Madsen)
+* Better handling of "application/xml" POST content types (patch by Ignacio Burgueño)
+* Fixed Bug [#1910] - Bug in byte accounting in post.lua (found by Greg Bell)
+
+Version 5.1.0 [23/Aug/2007]
+
+* Uses Lua 5.1
+* Added function cgilua.print (that uses tostring on its parameters)
+* Added a generic dispatcher and the concept of CGILua Apps
+* Replaced the cgi table used until CGILua 5.0 by two others cgilua.QUERY and cgilua.POST)
+* Added fake "package" table to enable the user/programmer to create modules with global visibility
+* Bug fix: return of HTTP status code
+* Bug fix: close method was recreating the session file
+* Correcting how LP handles strings with CR characters (Lua 5.0 would not mind, but Lua 5.1 does)
+* Fixed a bug with lighttpd
+
+Version 5.0.1 [20/Sep/2006]
+
+* Uses Compat-5.1 Release 5.
+* Caches Lua Pages template strings.
+* New configuration examples.
+* Improvements in the Session library.
+* Removed the debug package from the user scripts environment.
+* POST handling bug fixes (related to the text/plain content type).
+
+Version 5.0 [23/Jul/2005]
+
+* CGILua distribution includes now only the Lua files, the launchers have been moved to Kepler.
+* The Stable library is now distributed with VEnv.
+* Fixed a file upload bug in the CGI and Xavante launchers.
+* cgilua.lp.include() now accepts an environment to run the preprocessed file in it.
+
+Version 5.0 beta 2 [23/Dec/2004]
+
+* Distribution bug fix: stable.lua was missing
+
+Version 5.0 beta [15/Dec/2004]
+
+* New ISAPI and Servlet Launchers.
+* New Error Handling features.
+* New persistent data feature (Stable).
+* Uses the package model for Lua 5.1.
+* Simpler User Session API.
+* Small bug corrections
+
+Version 5.0 alpha 3 [8/Jun/2004]
+Version 5.0 alpha [21/Apr/2004]
+
+Incompatibility with previous CGILua versions (5.0, 4.0 and 3.x)
+
+* CGILua 5.1 uses Lua 5.1.
+* The cgi table is now deprecated. See Receiving parameters for a more detailed explanation.
+* The template tags have changed. See Lua pages for a more detailed explanation.
+* The use of getenv calls to obtain CGI variables should be replaced by cgilua.servervariable calls.
+
+## Credits
+
+CGILua 5.1
+
+CGILua 5.1 is being maintained by André Carregal and Tomás Guisasola with contributions from Fábio Mascarenhas and others from the Kepler mailing list. 
+
+CGILua 5.0
+
+CGILua 5.0 was completely redesigned by Roberto Ierusalimschy, André Carregal and Tomás Guisasola as part of the Kepler Project. The implementation is compatible with Lua 5.0 and was coded by Tomás Guisasola with invaluable contributions by Ana Lúcia de Moura, Fábio Mascarenhas and Danilo Tuler. CGILua 5.0 development was sponsored by Fábrica Digital, FINEP and CNPq.
+
+CGILua 4.0
+
+Ana Lúcia de Moura adapted CGILua 3.2 to Lua 4.0, reimplemented some code and added a few improvements but this version was not officially distributed.
+
+CGILua 3.x
+
+CGILua was born as the evolution of an early system developed by Renato Ferreira Borges and André Clínio at TeCGraf. At the time (circa 1995) there were no CGI tools available and everything was done with shell scripts!
+However, the main contribution to CGILua 3 was done by Anna Hester, who consolidated the whole tool and developed a consistent distribution with versions 3.1 and 3.2 (the number was an effort to follow Lua version numbers). This version was widely used on a great variety of systems.
diff -pruN 5.2~alpha2-2/debian/changelog 6.0.2-2/debian/changelog
--- 5.2~alpha2-2/debian/changelog	2022-11-15 11:02:58.000000000 +0000
+++ 6.0.2-2/debian/changelog	2025-10-13 17:20:14.000000000 +0000
@@ -1,3 +1,39 @@
+lua-cgi (6.0.2-2) unstable; urgency=medium
+
+  * Team upload
+  * Drop lua5.2 support
+  * Conform to the machine-readable copyright standard
+  * Drop implicit LUA_VERSION which makes this lua5.1-only
+
+ -- Bastian Germann <bage@debian.org>  Mon, 13 Oct 2025 19:20:14 +0200
+
+lua-cgi (6.0.2-1) unstable; urgency=medium
+
+  [ Debian Janitor ]
+  * Trim trailing whitespace.
+  * Use secure copyright file specification URI.
+  * Bump debhelper from deprecated 8 to 13.
+  * Set debhelper-compat version in Build-Depends.
+  * Set upstream metadata fields: Bug-Database, Bug-Submit, Repository-Browse.
+  * Use secure URI in Vcs control header Vcs-Git.
+  * Update Vcs-* headers from URL redirect.
+  * Use canonical URL in Vcs-Git.
+
+  [ Andreas Tille ]
+  * New upstream version
+  * d/watch
+     - version=4
+     - Fix github parsing
+  * Fix Homepage
+  * Add support for Lua 5.3 and 5.4
+  * Standards-Version: 4.7.2 (routine-update)
+  * Remove trailing whitespace in debian/changelog (routine-update)
+  * Remove trailing whitespace in debian/copyright (routine-update)
+  * Set upstream metadata fields: Repository.
+  * No potentially privacy breaking images
+
+ -- Andreas Tille <tille@debian.org>  Sat, 23 Aug 2025 22:11:08 +0200
+
 lua-cgi (5.2~alpha2-2) unstable; urgency=medium
 
   * QA upload.
@@ -5,19 +41,12 @@ lua-cgi (5.2~alpha2-2) unstable; urgency
 
  -- Marcos Talau <talau@debian.org>  Tue, 15 Nov 2022 08:02:58 -0300
 
-lua-cgi (5.2~alpha2-1.1) unstable; urgency=medium
-
-  * Non maintainer upload by the Reproducible Builds team.
-  * No source change upload to rebuild on buildd with .buildinfo files.
-
- -- Holger Levsen <holger@debian.org>  Mon, 04 Jan 2021 16:34:18 +0100
-
 lua-cgi (5.2~alpha2-1) unstable; urgency=low
 
   * Packaging moved to git
-  * Remove transitional packages 
+  * Remove transitional packages
   * New upstream release working on lua5.2 too
-  * Removing embedded sapi library, recommend lua-wsapi 
+  * Removing embedded sapi library, recommend lua-wsapi
 
  -- Enrico Tassi <gareuselesinge@debian.org>  Fri, 11 May 2012 09:43:50 +0200
 
@@ -35,7 +64,7 @@ lua-cgi (5.1.4+dfsg-1) unstable; urgency
 
 lua-cgi (5.1.4-2) unstable; urgency=low
 
-  * Ship a non minimized version of jquery.js and mention it in the copyright 
+  * Ship a non minimized version of jquery.js and mention it in the copyright
 
  -- Enrico Tassi <gareuselesinge@debian.org>  Tue, 01 May 2012 11:03:11 +0200
 
@@ -52,14 +81,14 @@ lua-cgi (5.1.4-1) unstable; urgency=low
 lua-cgi (5.1.3-3) unstable; urgency=low
 
   * source format 3.0 (quilt)
-  * bumped standards-version to 3.9.2, no changes needed  
+  * bumped standards-version to 3.9.2, no changes needed
 
  -- Enrico Tassi <gareuselesinge@debian.org>  Fri, 22 Jul 2011 12:39:55 +0200
 
 lua-cgi (5.1.3-2) unstable; urgency=low
 
   * build depend on lua5.1-policy-dev >= 22
-  * bumped standards-version to 3.8.2, no changes needed 
+  * bumped standards-version to 3.8.2, no changes needed
 
  -- Enrico Tassi <gareuselesinge@debian.org>  Tue, 21 Jul 2009 18:10:12 +0200
 
diff -pruN 5.2~alpha2-2/debian/compat 6.0.2-2/debian/compat
--- 5.2~alpha2-2/debian/compat	2013-08-12 07:47:34.000000000 +0000
+++ 6.0.2-2/debian/compat	1970-01-01 00:00:00.000000000 +0000
@@ -1 +0,0 @@
-8
diff -pruN 5.2~alpha2-2/debian/control 6.0.2-2/debian/control
--- 5.2~alpha2-2/debian/control	2022-11-15 11:02:58.000000000 +0000
+++ 6.0.2-2/debian/control	2025-10-13 17:06:54.000000000 +0000
@@ -2,11 +2,11 @@ Source: lua-cgi
 Section: interpreters
 Priority: optional
 Maintainer: Debian QA Group <packages@qa.debian.org>
-Build-Depends: debhelper (>= 8), dh-lua
-Standards-Version: 3.9.3
-Vcs-Git: git://git.debian.org/git/pkg-lua/lua-cgi.git
-Vcs-Browser: http://git.debian.org/?p=pkg-lua/luacgi.git
-Homepage: http://keplerproject.github.com/cgilua/
+Build-Depends: debhelper-compat (= 13), dh-lua
+Standards-Version: 4.7.2
+Vcs-Git: https://salsa.debian.org/lua-team/lua-cgi.git
+Vcs-Browser: https://salsa.debian.org/lua-team/lua-cgi
+Homepage: https://lunarmodules.github.io/cgilua/
 
 Package: lua-cgi
 Architecture: all
diff -pruN 5.2~alpha2-2/debian/copyright 6.0.2-2/debian/copyright
--- 5.2~alpha2-2/debian/copyright	2013-08-12 07:47:34.000000000 +0000
+++ 6.0.2-2/debian/copyright	2025-10-13 17:12:13.000000000 +0000
@@ -1,18 +1,20 @@
-Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 Upstream-Name: cgilua
 Upstream-Contact: Fabio Mascarenhas <mascarenhas@acm.org>
 Source: https://github.com/keplerproject/cgilua
 
 Files: *
 Copyright: 2003-2007 The Kepler Project.
-License: MIT
+License: Expat
 
 Files: examples/jquery/jquery-1.2.3*.js
 Copyright: 2008 John Resig (jquery.com)
-License: MIT or GPL-2
+License: Expat or GPL-2
+
+License: GPL-2
   A copy of the GPL license can be found in /usr/share/common-licenses.
-  
-License: MIT
+
+License: Expat
   Permission is hereby granted, free of charge, to any person obtaining a copy
   of this software and associated documentation files (the "Software"), to
   deal in the Software without restriction, including without limitation the
diff -pruN 5.2~alpha2-2/debian/lua5.1.dh-lua.conf 6.0.2-2/debian/lua5.1.dh-lua.conf
--- 5.2~alpha2-2/debian/lua5.1.dh-lua.conf	2013-08-12 07:47:34.000000000 +0000
+++ 6.0.2-2/debian/lua5.1.dh-lua.conf	2025-10-13 17:13:10.000000000 +0000
@@ -1,4 +1,3 @@
-LUA_VERSION=5.1
 PKG_NAME=cgi
 
 CLIB_CFLAGS=
diff -pruN 5.2~alpha2-2/debian/lua5.2.dh-lua.conf 6.0.2-2/debian/lua5.2.dh-lua.conf
--- 5.2~alpha2-2/debian/lua5.2.dh-lua.conf	2013-08-12 07:47:34.000000000 +0000
+++ 6.0.2-2/debian/lua5.2.dh-lua.conf	1970-01-01 00:00:00.000000000 +0000
@@ -1,19 +0,0 @@
-LUA_VERSION=5.1
-PKG_NAME=cgi
-
-CLIB_CFLAGS=
-CLIB_LDFLAGS=
-CLIB_OBJS=
-
-LUA_HEADER=
-LUA_SOURCES=$(wildcard src/*.lua src/cgilua/*.lua src/sapi/*.lua src/sapi/*/*.lua)
-LUA_SOURCES_MANGLER=sed -e s?^src/?? -e s?cgilua/cgilua.lua?cgilua.lua?
-LUA_MODNAME=cgilua
-LUA_TEST=
-LUA_MODNAME_CPART=
-
-PKG_VERSION=$(shell dpkg-parsechangelog|grep ^Ver|cut -d ' ' -f 2|cut -d '-' -f 1)
-PKG_LIBS_PRIVATE=
-PKG_URL=https://github.com/keplerproject/cgilua
-PKG_REQUIRES=
-PKG_CONFLICTS=
diff -pruN 5.2~alpha2-2/debian/lua5.3.dh-lua.conf 6.0.2-2/debian/lua5.3.dh-lua.conf
--- 5.2~alpha2-2/debian/lua5.3.dh-lua.conf	1970-01-01 00:00:00.000000000 +0000
+++ 6.0.2-2/debian/lua5.3.dh-lua.conf	2025-10-13 17:13:10.000000000 +0000
@@ -0,0 +1,18 @@
+PKG_NAME=cgi
+
+CLIB_CFLAGS=
+CLIB_LDFLAGS=
+CLIB_OBJS=
+
+LUA_HEADER=
+LUA_SOURCES=$(wildcard src/*.lua src/cgilua/*.lua src/sapi/*.lua src/sapi/*/*.lua)
+LUA_SOURCES_MANGLER=sed -e s?^src/?? -e s?cgilua/cgilua.lua?cgilua.lua?
+LUA_MODNAME=cgilua
+LUA_TEST=
+LUA_MODNAME_CPART=
+
+PKG_VERSION=$(shell dpkg-parsechangelog|grep ^Ver|cut -d ' ' -f 2|cut -d '-' -f 1)
+PKG_LIBS_PRIVATE=
+PKG_URL=https://github.com/keplerproject/cgilua
+PKG_REQUIRES=
+PKG_CONFLICTS=
diff -pruN 5.2~alpha2-2/debian/lua5.4.dh-lua.conf 6.0.2-2/debian/lua5.4.dh-lua.conf
--- 5.2~alpha2-2/debian/lua5.4.dh-lua.conf	1970-01-01 00:00:00.000000000 +0000
+++ 6.0.2-2/debian/lua5.4.dh-lua.conf	2025-10-13 17:13:10.000000000 +0000
@@ -0,0 +1,18 @@
+PKG_NAME=cgi
+
+CLIB_CFLAGS=
+CLIB_LDFLAGS=
+CLIB_OBJS=
+
+LUA_HEADER=
+LUA_SOURCES=$(wildcard src/*.lua src/cgilua/*.lua src/sapi/*.lua src/sapi/*/*.lua)
+LUA_SOURCES_MANGLER=sed -e s?^src/?? -e s?cgilua/cgilua.lua?cgilua.lua?
+LUA_MODNAME=cgilua
+LUA_TEST=
+LUA_MODNAME_CPART=
+
+PKG_VERSION=$(shell dpkg-parsechangelog|grep ^Ver|cut -d ' ' -f 2|cut -d '-' -f 1)
+PKG_LIBS_PRIVATE=
+PKG_URL=https://github.com/keplerproject/cgilua
+PKG_REQUIRES=
+PKG_CONFLICTS=
diff -pruN 5.2~alpha2-2/debian/patches/privacy.patch 6.0.2-2/debian/patches/privacy.patch
--- 5.2~alpha2-2/debian/patches/privacy.patch	1970-01-01 00:00:00.000000000 +0000
+++ 6.0.2-2/debian/patches/privacy.patch	2025-10-13 17:06:54.000000000 +0000
@@ -0,0 +1,71 @@
+Author: Andreas Tille <tille@debian.org>
+Last-Update: 2025-08-23
+Forwarded: No
+Description: No potentially privacy breaking images
+
+--- a/doc/br/index.html
++++ b/doc/br/index.html
+@@ -152,7 +152,7 @@ Uma das vantagens do CGILua &eacute; sua
+ </div> <!-- id="main" -->
+ 
+ <div id="about">
+-	<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="XHTML 1.0 v&aacute;lido!" height="31" width="88" /></a></p>
++	<p><a href="http://validator.w3.org/check?uri=referer">valid</a></p>
+ 	<p><small>$Id: index.html,v 1.3 2005/11/03 18:48:57 carregal Exp $</small></p>
+ </div> <!-- id="about" -->
+ 
+--- a/doc/br/libraries.html
++++ b/doc/br/libraries.html
+@@ -133,7 +133,7 @@
+ </div> <!-- id="main" -->
+ 
+ <div id="about">
+-	<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="XHTML 1.0 v&aacute;lido!" height="31" width="88" /></a></p>
++	<p><a href="http://validator.w3.org/check?uri=referer">valid</a></p>
+ 	<p><small>$Id: libraries.html,v 1.3 2005/11/03 18:48:57 carregal Exp $</small></p>
+ </div> <!-- id="about" -->
+ 
+--- a/doc/br/license.html
++++ b/doc/br/license.html
+@@ -92,7 +92,7 @@
+ </div> <!-- id="main" -->
+ 
+ <div id="about">
+-	<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="XHTML 1.0 v&aacute;lido!" height="31" width="88" /></a></p>
++	<p><a href="http://validator.w3.org/check?uri=referer">valid</a></p>
+ 	<p><small>$Id: license.html,v 1.3 2005/11/03 18:48:57 carregal Exp $</small></p>
+ </div> <!-- id="about" -->
+ 
+--- a/doc/br/manual.html
++++ b/doc/br/manual.html
+@@ -260,7 +260,7 @@ end
+ </div> <!-- id="main" -->
+ 
+ <div id="about">
+-	<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="XHTML 1.0 v&aacute;lido!" height="31" width="88" /></a></p>
++	<p><a href="http://validator.w3.org/check?uri=referer">valid</a></p>
+ 	<p><small>$Id: manual.html,v 1.3 2005/11/03 18:48:57 carregal Exp $</small></p>
+ </div> <!-- id="about" -->
+ 
+--- a/doc/br/reference.html
++++ b/doc/br/reference.html
+@@ -242,7 +242,7 @@
+ </div> <!-- id="main" -->
+ 
+ <div id="about">
+-	<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="XHTML 1.0 v&aacute;lido!" height="31" width="88" /></a></p>
++	<p><a href="http://validator.w3.org/check?uri=referer">valid</a></p>
+ 	<p><small>$Id: reference.html,v 1.4 2005/11/03 18:48:57 carregal Exp $</small></p>
+ </div> <!-- id="about" -->
+ 
+--- a/doc/br/sapi.html
++++ b/doc/br/sapi.html
+@@ -142,7 +142,7 @@
+ </div> <!-- id="main" -->
+ 
+ <div id="about">
+-	<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="XHTML 1.0 v&aacute;lido!" height="31" width="88" /></a></p>
++	<p><a href="http://validator.w3.org/check?uri=referer">valid</a></p>
+ 	<p><small>$Id: sapi.html,v 1.3 2005/11/03 18:48:57 carregal Exp $</small></p>
+ </div> <!-- id="about" -->
+ 
diff -pruN 5.2~alpha2-2/debian/patches/series 6.0.2-2/debian/patches/series
--- 5.2~alpha2-2/debian/patches/series	2013-08-12 07:47:34.000000000 +0000
+++ 6.0.2-2/debian/patches/series	2025-10-13 17:06:54.000000000 +0000
@@ -1 +1,2 @@
 0002-Non-minimized-version-of-jquery-to-adhere-DFSG.patch
+privacy.patch
diff -pruN 5.2~alpha2-2/debian/upstream/metadata 6.0.2-2/debian/upstream/metadata
--- 5.2~alpha2-2/debian/upstream/metadata	1970-01-01 00:00:00.000000000 +0000
+++ 6.0.2-2/debian/upstream/metadata	2025-10-13 17:06:54.000000000 +0000
@@ -0,0 +1,5 @@
+---
+Bug-Database: https://github.com/lunarmodules/cgilua/issues
+Bug-Submit: https://github.com/lunarmodules/cgilua/issues/new
+Repository: https://github.com/lunarmodules/cgilua.git
+Repository-Browse: https://github.com/lunarmodules/cgilua
diff -pruN 5.2~alpha2-2/debian/watch 6.0.2-2/debian/watch
--- 5.2~alpha2-2/debian/watch	2013-08-12 07:47:34.000000000 +0000
+++ 6.0.2-2/debian/watch	2025-10-13 17:06:54.000000000 +0000
@@ -1,5 +1,4 @@
-# test this watch file using:
-# uscan --watchfile debian/watch --upstream-version 0.0.1 --package lua-cgi
-#
-version=3
-https://github.com/keplerproject/cgilua/downloads /downloads/.*/cgilua-([\d\.]*).tar.gz
+version=4
+
+opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%@PACKAGE@-$1.tar.gz%" \
+   https://github.com/keplerproject/cgilua/tags (?:.*?/)?v?(\d[\d.]*)\.tar\.gz
diff -pruN 5.2~alpha2-2/doc/us/doc.css 6.0.2-2/doc/us/doc.css
--- 5.2~alpha2-2/doc/us/doc.css	1970-01-01 00:00:00.000000000 +0000
+++ 6.0.2-2/doc/us/doc.css	2020-07-04 15:27:37.000000000 +0000
@@ -0,0 +1,212 @@
+body { 
+    color: #47555c;
+    font-size: 16px;
+    font-family: "Open Sans", sans-serif;
+    margin: 0;
+    padding: 0;
+    background: #eff4ff;
+}
+
+a:link { color: #008fee; }
+a:visited { color: #008fee; }
+a:hover { color: #22a7ff; }
+
+h1 { font-size:26px; }
+h2 { font-size:24px; }
+h3 { font-size:18px; }
+h4 { font-size:16px; }
+
+hr {
+    height: 1px;
+    background: #c1cce4;
+    border: 0px;
+    margin: 20px 0;
+}
+
+code {
+    font-family: "Open Sans Mono", "Andale Mono", monospace; 
+}
+
+tt {
+    font-family: "Open Sans Mono", "Andale Mono", monospace; 
+}
+
+body, td, th {
+}
+
+textarea, pre, tt {
+    font-family: "Open Sans Mono", "Andale Mono", monospace; 
+}
+
+img {
+    border-width: 0px;
+}
+
+.example {
+    background-color: #323744;
+    color: white;
+    font-size: 16px;
+    padding: 16px 24px;
+    border-radius: 2px;
+    overflow-x: auto;
+}
+
+div.header, div.footer {
+}
+
+#container {
+}
+
+#product {
+    background-color: white;
+    padding: 10px;
+    height: 130px;
+    border-bottom: solid #d3dbec 1px;
+}
+
+#product big {
+    font-size: 42px;
+}
+#product strong {
+    font-weight: normal;
+}
+
+#product_logo {
+    float: right;
+}
+
+#product_name {
+    padding-top: 15px;
+    padding-left: 30px;
+    font-size: 42px;
+    font-weight: normal;
+}
+
+#product_description {
+    padding-left: 30px;
+    color: #757779;
+}
+
+#main {
+    background: #eff4ff;
+    margin: 0;
+}
+
+#navigation {
+    width: 100%;
+    background-color: rgb(44,62,103);
+    padding: 10px;
+    margin: 0;
+}
+
+#navigation h1 {
+    display: none;
+}
+
+#navigation a:hover {
+    text-decoration: underline;
+}
+
+#navigation ul li a {
+    color: rgb(136, 208, 255);
+    font-weight: bold;
+    text-decoration: none;
+}
+
+#navigation ul li li a {
+    color: rgb(136, 208, 255);
+    font-weight: normal;
+    text-decoration: none;
+}
+
+#navigation ul {
+    display: inline;
+    color: white;
+    padding: 0px;
+    padding-top: 10px;
+    padding-bottom: 10px;
+}
+
+#navigation li {
+    display: inline;
+    list-style-type: none;
+    padding-left: 5px;
+    padding-right: 5px;
+}
+
+#navigation li {
+    padding: 10px;
+    padding: 10px;
+}
+
+#navigation li li {
+}
+
+#navigation li:hover a {
+    color: rgb(166, 238, 255);
+}
+
+#content {
+    padding: 20px;
+    width: 800px;
+    margin-left: auto;
+    margin-right: auto;
+}
+
+#about {
+    display: none;
+}
+
+dl.reference {
+    background-color: white;
+    padding-left: 20px;
+    padding-right: 20px;
+    padding-bottom: 20px;
+    border: solid #d3dbec 1px;
+}
+
+dl.reference dt {
+    padding: 5px;
+    padding-top: 25px;
+    color: #637bbc;
+}
+
+dl.reference dl dt {
+    padding-top: 5px;
+    color: #637383;
+}
+
+dl.reference dd {
+}
+
+@media print {
+    body {
+        font: 10pt "Times New Roman", "TimeNR", Times, serif;
+    }
+    a {
+        font-weight:bold; color: #004080; text-decoration: underline;
+    }
+    #main {
+        background-color: #ffffff; border-left: 0px;
+    }
+    #container {
+        margin-left: 2%; margin-right: 2%; background-color: #ffffff;
+    }
+    #content {
+        margin-left: 0px; padding: 1em; border-left: 0px; border-right: 0px; background-color: #ffffff;
+    }
+    #navigation {
+        display: none;
+    }
+    #product_logo {
+        display: none;
+    }
+    #about img {
+        display: none;
+    }
+    .example {
+        font-family: "Andale Mono", monospace; 
+        font-size: 8pt;
+        page-break-inside: avoid;
+    }
+}
diff -pruN 5.2~alpha2-2/doc/us/index.html 6.0.2-2/doc/us/index.html
--- 5.2~alpha2-2/doc/us/index.html	2013-08-09 13:09:14.000000000 +0000
+++ 6.0.2-2/doc/us/index.html	2020-07-04 15:27:37.000000000 +0000
@@ -3,7 +3,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
     <title>CGILua: Building Web Scripts with Lua</title>
-    <link rel="stylesheet" href="http://www.keplerproject.org/doc.css" type="text/css"/>
+    <link rel="stylesheet" href="doc.css" type="text/css"/>
 	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
 </head>
 <body>
@@ -11,10 +11,10 @@
 <div id="container">
 	
 <div id="product">
-	<div id="product_logo"><a href="http://www.keplerproject.org">
+	<div id="product_logo">
 		<img alt="CGILua logo" src="cgi-128.gif"/>
-	</a></div>
-	<div id="product_name"><big><b>CGILua</b></big></div>
+	</div>
+	<div id="product_name"><big><strong>CGILua</strong></big></div>
 	<div id="product_description">Building Web Scripts with Lua</div>
 </div> <!-- id="product" -->
 
@@ -35,39 +35,10 @@
 			</ul>
 		</li>
 		<li><a href="manual.html">Manual</a>
-			<ul>
-				<li><a href="manual.html#intro">Introduction</a></li>
-				<li><a href="manual.html#installation">Installation</a></li>
-				<li><a href="manual.html#config">Configuration</a></li>
-				<li><a href="manual.html#scripts">Lua Scripts</a></li>
-				<li><a href="manual.html#templates">Lua Pages</a></li>
-				<li><a href="manual.html#parameters">Parameters</a></li>
-				<li><a href="manual.html#dispatching">Dispatching</a></li>
-                <li><a href="manual.html#authentication">Authentication</a></li>
-                <li><a href="manual.html#error_handling">Error Handling</a></li>
-			</ul>
 		</li>
 		<li><a href="reference.html">Reference</a>
-			<ul>
-				<li><a href="reference.html#headers">Headers</a></li>
-				<li><a href="reference.html#contents">Content Generation</a></li>
-				<li><a href="reference.html#prep">Lua Pages</a></li>
-				<li><a href="reference.html#variables">CGILua Variables</a></li>
-				<li><a href="reference.html#error_handling">Error Handling</a></li>
-				<li><a href="reference.html#behavior">CGILua Behavior</a></li>
-				<li><a href="reference.html#urlcode">URL Encoding</a></li>
-				<li><a href="reference.html#auxiliar">Auxiliary functions</a></li>
-				<li><a href="reference.html#index">Alphabetic Index</a></li>
-			</ul>
 		</li>
 		<li><a href="libraries.html">Libraries</a>
-			<ul>
-				<li><a href="libraries.html#authentication">Authentication</a></li>
-				<li><a href="libraries.html#cookies">Cookies</a></li>
-				<li><a href="libraries.html#dispatcher">Dispatcher</a></li>
-				<li><a href="libraries.html#serialize">Serialize</a></li>
-				<li><a href="libraries.html#session">Session</a></li>
-			</ul>
 		</li>
 		<li><a href="sapi.html">SAPI</a></li>
 		<li><a href="license.html">License</a></li>
@@ -99,7 +70,7 @@ as Lua 5.1.
 
 <h2><a name="status"></a>Status</h2>
 
-<p>Current version is 5.1.4</p>
+<p>Current version is 5.2</p>
 
 <h2><a name="download"></a>Download</h2>
 
@@ -115,6 +86,11 @@ luarocks install cgilua
 <h2><a name="history"></a>History</h2>
 
 <dl>
+    <dt><strong>Version 5.2</strong> [22/Apr/2015]</dt>
+	<dd><ul>
+        <li>Code adapted to work with Lua 5.1 and Lua 5.2</li>
+	</ul></dd>
+
     <dt><strong>Version 5.1.4</strong> [22/Mar/2010]</dt>
 	<dd><ul>
         <li>Fixes file upload reentrancy</li>
@@ -248,7 +224,14 @@ luarocks install cgilua
 
 <h2><a name="incompatibility"></a>Incompatibility with previous CGILua versions (5.0, 4.0 and 3.x)</h2>
 
-<ul>
+<dt><strong>CGILua 5.2</strong></dt>
+<dd><ul>
+    <li>All CGILua 5.2 modules return a table when loaded.</li>
+    <li>Function <code>cgilua.lp.include</code> ...
+</ul></dd>
+
+<dt><strong>CGILua 5.1</strong></dt>
+<dd><ul>
     <li>CGILua 5.1 uses <a href="http://www.lua.org">Lua 5.1</a>.</li>
     <li>The <code>cgi</code> table is now deprecated. See
     <a href="manual.html#parameters">Receiving parameters</a> for a more
@@ -260,11 +243,18 @@ luarocks install cgilua
     should be replaced by
     <a href="reference.html#servervariable"><code>cgilua.servervariable</code></a>
     calls.</li>
-</ul>
+</ul></dd>
 
 <h2><a name="credits"></a>Credits</h2>
 
 <dl>
+    <dt><strong>CGILua 5.2</strong></dt>
+    <dd>
+    CGILua 5.2 is being maintained by Tom&aacute;s Guisasola
+    with contributions from F&aacute;bio Mascarenhas, Carla Ourofino
+    and others from the Kepler community.
+    </dd>
+    
     <dt><strong>CGILua 5.1</strong></dt>
     <dd>
     CGILua 5.1 is being maintained by Andr&eacute; Carregal and
diff -pruN 5.2~alpha2-2/doc/us/libraries.html 6.0.2-2/doc/us/libraries.html
--- 5.2~alpha2-2/doc/us/libraries.html	2013-08-09 13:09:14.000000000 +0000
+++ 6.0.2-2/doc/us/libraries.html	2020-07-04 15:27:37.000000000 +0000
@@ -3,7 +3,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
     <title>CGILua: Building Web Scripts with Lua</title>
-    <link rel="stylesheet" href="http://www.keplerproject.org/doc.css" type="text/css"/>
+    <link rel="stylesheet" href="doc.css" type="text/css"/>
 	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
 </head>
 <body>
@@ -11,9 +11,9 @@
 <div id="container">
 	
 <div id="product">
-	<div id="product_logo"><a href="http://www.keplerproject.org">
+	<div id="product_logo">
 		<img alt="CGILua logo" src="cgi-128.gif"/>
-	</a></div>
+	</div>
 	<div id="product_name"><big><strong>CGILua</strong></big></div>
 	<div id="product_description">Building Web Scripts with Lua</div>
 </div> <!-- id="product" -->
@@ -24,41 +24,10 @@
 <h1>CGILua</h1>
 	<ul>
 		<li><a href="index.html">Home</a>
-			<ul>
-				<li><a href="index.html#overview">Overview</a></li>
-				<li><a href="index.html#status">Status</a></li>
-				<li><a href="index.html#download">Download</a></li>
-				<li><a href="index.html#history">History</a></li>
-				<li><a href="index.html#incompatibility">Incompatibilities</a></li>
-				<li><a href="index.html#credits">Credits</a></li>
-				<li><a href="index.html#contact">Contact us</a></li>
-			</ul>
 		</li>
 		<li><a href="manual.html">Manual</a>
-			<ul>
-				<li><a href="manual.html#intro">Introduction</a></li>
-				<li><a href="manual.html#installation">Installation</a></li>
-				<li><a href="manual.html#config">Configuration</a></li>
-				<li><a href="manual.html#scripts">Lua Scripts</a></li>
-				<li><a href="manual.html#templates">Lua Pages</a></li>
-				<li><a href="manual.html#parameters">Parameters</a></li>
-				<li><a href="manual.html#dispatching">Dispatching</a></li>
-                <li><a href="manual.html#authentication">Authentication</a></li>
-                <li><a href="manual.html#error_handling">Error Handling</a></li>
-			</ul>
 		</li>
 		<li><a href="reference.html">Reference</a>
-			<ul>
-				<li><a href="reference.html#headers">Headers</a></li>
-				<li><a href="reference.html#contents">Content Generation</a></li>
-				<li><a href="reference.html#prep">Lua Pages</a></li>
-				<li><a href="reference.html#variables">CGILua Variables</a></li>
-				<li><a href="reference.html#error_handling">Error Handling</a></li>
-				<li><a href="reference.html#behavior">CGILua Behavior</a></li>
-				<li><a href="reference.html#urlcode">URL Encoding</a></li>
-				<li><a href="reference.html#auxiliar">Auxiliary functions</a></li>
-				<li><a href="reference.html#index">Alphabetic Index</a></li>
-			</ul>
 		</li>
 		<li><strong>Libraries</strong>
 			<ul>
diff -pruN 5.2~alpha2-2/doc/us/license.html 6.0.2-2/doc/us/license.html
--- 5.2~alpha2-2/doc/us/license.html	2013-08-09 13:09:14.000000000 +0000
+++ 6.0.2-2/doc/us/license.html	2020-07-04 15:27:37.000000000 +0000
@@ -3,7 +3,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
     <title>CGILua: Building Web Scripts with Lua</title>
-    <link rel="stylesheet" href="http://www.keplerproject.org/doc.css" type="text/css"/>
+    <link rel="stylesheet" href="doc.css" type="text/css"/>
 	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
 </head>
 <body>
@@ -11,10 +11,10 @@
 <div id="container">
 	
 <div id="product">
-	<div id="product_logo"><a href="http://www.keplerproject.org">
+	<div id="product_logo">
 		<img alt="CGILua logo" src="cgi-128.gif"/>
-	</a></div>
-	<div id="product_name"><big><b>CGILua</b></big></div>
+	</div>
+	<div id="product_name"><big><strong>CGILua</strong></big></div>
 	<div id="product_description">Building Web Scripts with Lua</div>
 </div> <!-- id="product" -->
 
@@ -24,50 +24,12 @@
 <h1>CGILua</h1>
 	<ul>
 		<li><a href="index.html">Home</a>
-			<ul>
-				<li><a href="index.html#overview">Overview</a></li>
-				<li><a href="index.html#status">Status</a></li>
-				<li><a href="index.html#download">Download</a></li>
-				<li><a href="index.html#history">History</a></li>
-				<li><a href="index.html#incompatibility">Incompatibilities</a></li>
-				<li><a href="index.html#credits">Credits</a></li>
-				<li><a href="index.html#contact">Contact us</a></li>
-			</ul>
 		</li>
 		<li><a href="manual.html">Manual</a>
-			<ul>
-				<li><a href="manual.html#intro">Introduction</a></li>
-				<li><a href="manual.html#installation">Installation</a></li>
-				<li><a href="manual.html#config">Configuration</a></li>
-				<li><a href="manual.html#scripts">Lua Scripts</a></li>
-				<li><a href="manual.html#templates">Lua Pages</a></li>
-				<li><a href="manual.html#parameters">Parameters</a></li>
-				<li><a href="manual.html#dispatching">Dispatching</a></li>
-                <li><a href="manual.html#authentication">Authentication</a></li>
-                <li><a href="manual.html#error_handling">Error Handling</a></li>
-			</ul>
 		</li>
 		<li><a href="reference.html">Reference</a>
-			<ul>
-				<li><a href="reference.html#headers">Headers</a></li>
-				<li><a href="reference.html#contents">Content Generation</a></li>
-				<li><a href="reference.html#prep">Lua Pages</a></li>
-				<li><a href="reference.html#variables">CGILua Variables</a></li>
-				<li><a href="reference.html#error_handling">Error Handling</a></li>
-				<li><a href="reference.html#behavior">CGILua Behavior</a></li>
-				<li><a href="reference.html#urlcode">URL Encoding</a></li>
-				<li><a href="reference.html#auxiliar">Auxiliary functions</a></li>
-				<li><a href="reference.html#index">Alphabetic Index</a></li>
-			</ul>
 		</li>
 		<li><a href="libraries.html">Libraries</a>
-			<ul>
-				<li><a href="libraries.html#authentication">Authentication</a></li>
-				<li><a href="libraries.html#cookies">Cookies</a></li>
-				<li><a href="libraries.html#dispatcher">Dispatcher</a></li>
-				<li><a href="libraries.html#serialize">Serialize</a></li>
-				<li><a href="libraries.html#session">Session</a></li>
-			</ul>
 		</li>
 		<li><a href="sapi.html">SAPI</a></li>
 		<li><strong>License</strong></li>
diff -pruN 5.2~alpha2-2/doc/us/manual.html 6.0.2-2/doc/us/manual.html
--- 5.2~alpha2-2/doc/us/manual.html	2013-08-09 13:09:14.000000000 +0000
+++ 6.0.2-2/doc/us/manual.html	2020-07-04 15:27:37.000000000 +0000
@@ -3,7 +3,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
     <title>CGILua: Building Web Scripts with Lua</title>
-    <link rel="stylesheet" href="http://www.keplerproject.org/doc.css" type="text/css"/>
+    <link rel="stylesheet" href="doc.css" type="text/css"/>
 	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
 </head>
 <body>
@@ -11,9 +11,9 @@
 <div id="container">
 	
 <div id="product">
-	<div id="product_logo"><a href="http://www.keplerproject.org">
+	<div id="product_logo">
 		<img alt="CGILua logo" src="cgi-128.gif"/>
-	</a></div>
+	</div>
 	<div id="product_name"><big><strong>CGILua</strong></big></div>
 	<div id="product_description">Building Web Scripts with Lua</div>
 </div> <!-- id="product" -->
@@ -24,15 +24,6 @@
 <h1>CGILua</h1>
 	<ul>
 		<li><a href="index.html">Home</a>
-			<ul>
-				<li><a href="index.html#overview">Overview</a></li>
-				<li><a href="index.html#status">Status</a></li>
-				<li><a href="index.html#download">Download</a></li>
-				<li><a href="index.html#history">History</a></li>
-				<li><a href="index.html#incompatibility">Incompatibilities</a></li>
-				<li><a href="index.html#credits">Credits</a></li>
-				<li><a href="index.html#contact">Contact us</a></li>
-			</ul>
 		</li>
 		<li><strong>Manual</strong>
 			<ul>
@@ -48,26 +39,8 @@
 			</ul>
 		</li>
 		<li><a href="reference.html">Reference</a>
-			<ul>
-				<li><a href="reference.html#headers">Headers</a></li>
-				<li><a href="reference.html#contents">Content Generation</a></li>
-				<li><a href="reference.html#prep">Lua Pages</a></li>
-				<li><a href="reference.html#variables">CGILua Variables</a></li>
-				<li><a href="reference.html#error_handling">Error Handling</a></li>
-				<li><a href="reference.html#behavior">CGILua Behavior</a></li>
-				<li><a href="reference.html#urlcode">URL Encoding</a></li>
-				<li><a href="reference.html#auxiliar">Auxiliary functions</a></li>
-				<li><a href="reference.html#index">Alphabetic Index</a></li>
-			</ul>
 		</li>
 		<li><a href="libraries.html">Libraries</a>
-			<ul>
-				<li><a href="libraries.html#authentication">Authentication</a></li>
-				<li><a href="libraries.html#cookies">Cookies</a></li>
-				<li><a href="libraries.html#dispatcher">Dispatcher</a></li>
-				<li><a href="libraries.html#serialize">Serialize</a></li>
-				<li><a href="libraries.html#session">Session</a></li>
-			</ul>
 		</li>
 		<li><a href="sapi.html">SAPI</a></li>
 		<li><a href="license.html">License</a></li>
@@ -215,7 +188,7 @@ use something like:
 
 <pre class="example">
 cgilua.addopenfunction (function ()
-	cgilua.doif ("env.lua")
+   cgilua.doif ("env.lua")
 end)
 </pre>
 
@@ -224,7 +197,7 @@ If every script needs to load a module (
 </p>
 
 <pre class="example">
-require"cgilua.session"
+require("cgilua.session")
 cgilua.session.setsessiondir(CGILUA_TMP)
 cgilua.addopenfunction (cgilua.session.open)
 cgilua.addclosefunction (cgilua.session.close)
@@ -247,11 +220,11 @@ very beginning of each script that needs
 </p>
 
 <pre class="example">
-require"cgilua.session"
+require("cgilua.session")
 cgilua.session.setsessiondir(CGILUA_TMP)
 cgilua.enablesession = function ()
-	cgilua.session.open ()
-	cgilua.addclosefunction (cgilua.session.close)
+   cgilua.session.open ()
+   cgilua.addclosefunction (cgilua.session.close)
 end
 </pre>
 
@@ -264,14 +237,14 @@ but not in other application's private d
 
 <pre class="example">
 local app_lib_dir = {
-	["/virtual/path/"] = "/absolute/path/lib/",
+   ["/virtual/path/"] = "/absolute/path/lib/",
 }
 local package = package
 cgilua.addopenfunction (function ()
-	local app = app_lib_dir[cgilua.script_vdir]
-	if app then
-		package.path = app..'/?.lua'..';'..package.path
-	end
+   local app = app_lib_dir[cgilua.script_vdir]
+   if app then
+      package.path = app..'/?.lua'..';'..package.path
+   end
 end)
 </pre>
 
@@ -335,11 +308,11 @@ variables, and the concatenation operato
 cgilua.htmlheader()  
 
 if cgilua.QUERY.language == 'english' then
-  greeting = 'Hello World!'
+   greeting = 'Hello World!'
 elseif cgilua.QUERY.language == 'portuguese' then
-  greeting = 'Ol&aacute; Mundo!'
+   greeting = 'Ol&aacute; Mundo!'
 else
-  greeting = '[unknown language]'
+   greeting = '[unknown language]'
 end
 
 cgilua.put('&lt;html&gt;')  
@@ -441,15 +414,15 @@ was definied in file <code>functions.lua
 
 <pre class="example">
 function getGreeting()
-  local greeting
-  if cgilua.QUERY.language == 'english' then
-    greeting = 'Hello World!'
-  elseif cgilua.QUERY.language == 'portuguese' then
-    greeting = 'Ol&aacute; Mundo!'
-  else
-    greeting = '[unknown language]'
-  end
-  return greeting
+   local greeting
+   if cgilua.QUERY.language == 'english' then
+      greeting = 'Hello World!'
+   elseif cgilua.QUERY.language == 'portuguese' then
+      greeting = 'Ol&aacute; Mundo!'
+   else
+      greeting = '[unknown language]'
+   end
+   return greeting
 end
 </pre>
 
@@ -482,7 +455,7 @@ A Lua Script could do that using a loop
 <pre class="example">
 cgilua.put("&lt;ul&gt;")
 for i, item in ipairs(list) do
-    cgilua.put("&lt;li&gt;"..item.."&lt;/li&gt;")
+   cgilua.put("&lt;li&gt;"..item.."&lt;/li&gt;")
 end
 cgilua.put("&lt;/ul&gt;")
 </pre>
@@ -493,9 +466,9 @@ The equivalent loop in Lua Page would be
 
 <pre class="example">
 &lt;ul&gt;
-    &lt;% for i, item in ipairs(list) do %&gt;
-    &lt;li&gt;&lt;%= item %&gt;&lt;/li&gt;
-    &lt;% end %&gt;
+   &lt;% for i, item in ipairs(list) do %&gt;
+   &lt;li&gt;&lt;%= item %&gt;&lt;/li&gt;
+   &lt;% end %&gt;
 &lt;/ul&gt;
 </pre>
 
@@ -566,7 +539,7 @@ follow a convention similar to <a href="
 </p>
 
 <pre class="example">
-require"cgilua.dispatcher"
+require("cgilua.dispatcher")
 return cgilua.dispatcher.route{"/$controller/$action/$ID", handle, "rails"}
 </pre>
 
@@ -606,9 +579,9 @@ would do, it checks for the presence of
 <pre class="example">
 -- checks for authenticated users
 if not cgilua.authentication.username() then
-    cgilua.redirect(cgilua.authentication.checkURL())
+   cgilua.redirect(cgilua.authentication.checkURL())
 else
-    -- continues with the application flow
+   -- continues with the application flow
 end
 </pre>
 
@@ -635,25 +608,26 @@ local pass = cgilua.POST.pass
 local logged, err, logoutURL
 
 if cgilua.authentication then
-    logged, err = cgilua.authentication.check(username, pass)
-    username = cgilua.authentication.username() or ""
-    logoutURL = cgilua.authentication.logoutURL()
+   logged, err = cgilua.authentication.check(username, pass)
+   username = cgilua.authentication.username() or ""
+   logoutURL = cgilua.authentication.logoutURL()
 else
-    logged = false
-    err = "No authentication configured!"
-    username = ""
+   logged = false
+   err = "No authentication configured!"
+   username = ""
 end
 
 if logged and username then
-    -- goes back to the application
-	cgilua.redirect(cgilua.authentication.refURL())
+   -- goes back to the application
+   cgilua.redirect(cgilua.authentication.refURL())
 else
-    err = err or ""
-    -- displays the login form which submits to this same script
-	cgilua.htmlheader()
-	cgilua.lp.include ("login.lp", {
-        logged = logged, errorMsg = err, username = username,
-        cgilua = cgilua, logoutURL = logoutURL})
+   err = err or ""
+   -- displays the login form which submits to this same script
+   cgilua.htmlheader()
+   cgilua.lp.include ("login.lp", {
+      logged = logged, errorMsg = err, username = username,
+      cgilua = cgilua, logoutURL = logoutURL
+   })
 end
 </pre>
 
@@ -668,10 +642,10 @@ The login form for this example can be f
 &lt;% else %&gt;
 &lt;p style="color:#ff0000"&gt;&lt;%= errorMsg %&gt; &lt;/p&gt;
 &lt;form method="post" action="" &gt;
-    User name: &lt;input name="username" maxlength="20" size="20" value="&lt;%= username %&gt;" &gt;&lt;br /&gt;
-    Password: &lt;input name="pass" type="password" maxlength="20" size="20"&gt;&lt;br /&gt;
-    &lt;input type="submit" value="Login"&gt;
-    &lt;input type="reset" value="Reset"&gt;
+   User name: &lt;input name="username" maxlength="20" size="20" value="&lt;%= username %&gt;" &gt;&lt;br /&gt;
+   Password: &lt;input name="pass" type="password" maxlength="20" size="20"&gt;&lt;br /&gt;
+   &lt;input type="submit" value="Login"&gt;
+   &lt;input type="reset" value="Reset"&gt;
 &lt;/form&gt;
 &lt;% end %&gt;
 </pre>
@@ -723,58 +697,58 @@ piece of code:
 <pre class="example">
 local ip = cgilua.servervariable"REMOTE_ADDR"
 local developers_machines = {
-	["192.168.0.20"] = true,
-	["192.168.0.27"] = true,
-	["192.168.0.30"] = true,
+   ["192.168.0.20"] = true,
+   ["192.168.0.27"] = true,
+   ["192.168.0.30"] = true,
 }
 local function mail (s)
-	require"cgilua.serialize"
-	require"socket.smtp"
-	-- Build the message
-	local msg = {}
-	table.insert (msg, tostring(s))
-	-- Tries to obtain the REFERER URL
-	table.insert (msg, tostring (cgilua.servervariable"HTTP_REFERER"))
-	table.insert (msg, cgilua.servervariable"SERVER_NAME"..
-		cgilua.servervariable"SCRIPT_NAME")
-	-- CGI parameters
-	table.insert (msg, "CGI")
-	cgilua.serialize(cgi, function (s) table.insert (msg, s) end)
-	table.insert (msg, tostring (os.date()))
-	table.insert (msg, tostring (ip))
-	table.insert (msg, "Cookies:")
-	table.insert (msg, tostring (cgilua.servervariable"HTTP_COOKIE" or "no cookies"))
-	-- Formats message according to LuaSocket-2.0b3
-	local source = socket.smtp.message {
-		headers = { subject = "Script Error", },
-		body = table.concat (msg, '\n'),
-	}
-	-- Sends the message
-	local r, e = socket.smtp.send {
-		from = "sender@my.domain.net",
-		rcpt = "developers@my.domain.net",
-		source = source,
-	}
+   require"cgilua.serialize"
+   require"socket.smtp"
+   -- Build the message
+   local msg = {}
+   table.insert (msg, tostring(s))
+   -- Tries to obtain the REFERER URL
+   table.insert (msg, tostring (cgilua.servervariable"HTTP_REFERER"))
+   table.insert (msg, cgilua.servervariable"SERVER_NAME"..
+      cgilua.servervariable"SCRIPT_NAME")
+   -- CGI parameters
+   table.insert (msg, "CGI")
+   cgilua.serialize(cgi, function (s) table.insert (msg, s) end)
+   table.insert (msg, tostring (os.date()))
+   table.insert (msg, tostring (ip))
+   table.insert (msg, "Cookies:")
+   table.insert (msg, tostring (cgilua.servervariable"HTTP_COOKIE" or "no cookies"))
+   -- Formats message according to LuaSocket-2.0b3
+   local source = socket.smtp.message {
+      headers = { subject = "Script Error", },
+      body = table.concat (msg, '\n'),
+   }
+   -- Sends the message
+   local r, e = socket.smtp.send {
+      from = "sender@my.domain.net",
+      rcpt = "developers@my.domain.net",
+      source = source,
+   }
 end
 if developers_machines[ip] then
-	-- Developer's error treatment: write to the display
-	cgilua.seterroroutput (function (msg)
-		cgilua.errorlog (msg)
-		cgilua.errorlog (cgilua.servervariable"REMOTE_ADDR")
-		cgilua.errorlog (os.date())
-		cgilua.htmlheader ()
-		msg = string.gsub (string.gsub (msg, "\n", "&lt;br&gt;\n"), "\t", "&nbsp;&nbsp;")
-		cgilua.put (msg)
-	end)
+   -- Developer's error treatment: write to the display
+   cgilua.seterroroutput (function (msg)
+      cgilua.errorlog (msg)
+      cgilua.errorlog (cgilua.servervariable"REMOTE_ADDR")
+      cgilua.errorlog (os.date())
+      cgilua.htmlheader ()
+      msg = string.gsub (string.gsub (msg, "\n", "&lt;br&gt;\n"), "\t", "&nbsp;&nbsp;")
+      cgilua.put (msg)
+   end)
 else
-	-- User's error treatment: shows a standard page and sends an e-mail to
-	-- the developer
-	cgilua.seterroroutput (function (s)
-		cgilua.htmlheader ()
-		cgilua.put"&lt;h1&gt;An error occurred&lt;/h1&gt;\n"
-		cgilua.put"The responsible is being informed."
-		mail (s)
-	end)
+   -- User's error treatment: shows a standard page and sends an e-mail to
+   -- the developer
+   cgilua.seterroroutput (function (s)
+      cgilua.htmlheader ()
+      cgilua.put"&lt;h1&gt;An error occurred&lt;/h1&gt;\n"
+      cgilua.put"The responsible is being informed."
+      mail (s)
+   end)
 end
 </pre>
 
@@ -790,8 +764,8 @@ containing all possible information to h
 </div> <!-- id="main" -->
 
 <div id="about">
-	<p><a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.0!</a></p>
-	<p><small>$Id: manual.html,v 1.27 2008/05/19 18:13:36 carregal Exp $</small></p>
+   <p><a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.0!</a></p>
+   <p><small>$Id: manual.html,v 1.27 2008/05/19 18:13:36 carregal Exp $</small></p>
 </div> <!-- id="about" -->
 
 </div> <!-- id="container" -->
diff -pruN 5.2~alpha2-2/doc/us/reference.html 6.0.2-2/doc/us/reference.html
--- 5.2~alpha2-2/doc/us/reference.html	2013-08-09 13:09:14.000000000 +0000
+++ 6.0.2-2/doc/us/reference.html	2020-07-04 15:27:37.000000000 +0000
@@ -3,7 +3,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
     <title>CGILua: Building Web Scripts with Lua</title>
-    <link rel="stylesheet" href="http://www.keplerproject.org/doc.css" type="text/css"/>
+    <link rel="stylesheet" href="doc.css" type="text/css"/>
 	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
 </head>
 <body>
@@ -11,9 +11,9 @@
 <div id="container">
 	
 <div id="product">
-	<div id="product_logo"><a href="http://www.keplerproject.org">
+	<div id="product_logo">
 		<img alt="CGILua logo" src="cgi-128.gif"/>
-	</a></div>
+	</div>
 	<div id="product_name"><big><strong>CGILua</strong></big></div>
 	<div id="product_description">Building Web Scripts with Lua</div>
 </div> <!-- id="product" -->
@@ -24,28 +24,8 @@
 <h1>CGILua</h1>
 	<ul>
 		<li><a href="index.html">Home</a>
-			<ul>
-				<li><a href="index.html#overview">Overview</a></li>
-				<li><a href="index.html#status">Status</a></li>
-				<li><a href="index.html#download">Download</a></li>
-				<li><a href="index.html#history">History</a></li>
-				<li><a href="index.html#incompatibility">Incompatibilities</a></li>
-				<li><a href="index.html#credits">Credits</a></li>
-				<li><a href="index.html#contact">Contact us</a></li>
-			</ul>
 		</li>
 		<li><a href="manual.html">Manual</a>
-			<ul>
-				<li><a href="manual.html#intro">Introduction</a></li>
-				<li><a href="manual.html#installation">Installation</a></li>
-				<li><a href="manual.html#config">Configuration</a></li>
-				<li><a href="manual.html#scripts">Lua Scripts</a></li>
-				<li><a href="manual.html#templates">Lua Pages</a></li>
-				<li><a href="manual.html#parameters">Parameters</a></li>
-				<li><a href="manual.html#dispatching">Dispatching</a></li>
-                <li><a href="manual.html#authentication">Authentication</a></li>
-               <li><a href="manual.html#error_handling">Error Handling</a></li>
-			</ul>
 		</li>
 		<li><strong>Reference</strong>
 			<ul>
@@ -62,13 +42,6 @@
 			</ul>
 		</li>
 		<li><a href="libraries.html">Libraries</a>
-			<ul>
-				<li><a href="libraries.html#authentication">Authentication</a></li>
-				<li><a href="libraries.html#cookies">Cookies</a></li>
-				<li><a href="libraries.html#dispatcher">Dispatcher</a></li>
-				<li><a href="libraries.html#serialize">Serialize</a></li>
-				<li><a href="libraries.html#session">Session</a></li>
-			</ul>
 		</li>
 		<li><a href="sapi.html">SAPI</a></li>
 		<li><a href="license.html">License</a></li>
diff -pruN 5.2~alpha2-2/doc/us/sapi.html 6.0.2-2/doc/us/sapi.html
--- 5.2~alpha2-2/doc/us/sapi.html	2013-08-09 13:09:14.000000000 +0000
+++ 6.0.2-2/doc/us/sapi.html	2020-07-04 15:27:37.000000000 +0000
@@ -3,7 +3,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
     <title>CGILua: Building Web Scripts with Lua</title>
-    <link rel="stylesheet" href="http://www.keplerproject.org/doc.css" type="text/css"/>
+    <link rel="stylesheet" href="doc.css" type="text/css"/>
 	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
 </head>
 <body>
@@ -11,9 +11,9 @@
 <div id="container">
 	
 <div id="product">
-	<div id="product_logo"><a href="http://www.keplerproject.org">
+	<div id="product_logo">
 		<img alt="CGILua logo" src="cgi-128.gif"/>
-	</a></div>
+	</div>
 	<div id="product_name"><big><strong>CGILua</strong></big></div>
 	<div id="product_description">Building Web Scripts with Lua</div>
 </div> <!-- id="product" -->
@@ -24,50 +24,12 @@
 <h1>CGILua</h1>
 	<ul>
 		<li><a href="index.html">Home</a>
-			<ul>
-				<li><a href="index.html#overview">Overview</a></li>
-				<li><a href="index.html#status">Status</a></li>
-				<li><a href="index.html#download">Download</a></li>
-				<li><a href="index.html#history">History</a></li>
-				<li><a href="index.html#incompatibility">Incompatibilities</a></li>
-				<li><a href="index.html#credits">Credits</a></li>
-				<li><a href="index.html#contact">Contact us</a></li>
-			</ul>
 		</li>
 		<li><a href="manual.html">Manual</a>
-			<ul>
-				<li><a href="manual.html#intro">Introduction</a></li>
-				<li><a href="manual.html#installation">Installation</a></li>
-				<li><a href="manual.html#config">Configuration</a></li>
-				<li><a href="manual.html#scripts">Lua Scripts</a></li>
-				<li><a href="manual.html#templates">Lua Pages</a></li>
-				<li><a href="manual.html#parameters">Parameters</a></li>
-				<li><a href="manual.html#dispatching">Dispatching</a></li>
-                <li><a href="manual.html#authentication">Authentication</a></li>
-                <li><a href="manual.html#error_handling">Error Handling</a></li>
-			</ul>
 		</li>
 		<li><a href="reference.html">Reference</a>
-			<ul>
-				<li><a href="reference.html#headers">Headers</a></li>
-				<li><a href="reference.html#contents">Content Generation</a></li>
-				<li><a href="reference.html#prep">Lua Pages</a></li>
-				<li><a href="reference.html#variables">CGILua Variables</a></li>
-				<li><a href="reference.html#error_handling">Error Handling</a></li>
-				<li><a href="reference.html#behavior">CGILua Behavior</a></li>
-				<li><a href="reference.html#urlcode">URL Encoding</a></li>
-				<li><a href="reference.html#auxiliar">Auxiliary functions</a></li>
-				<li><a href="reference.html#index">Alphabetic Index</a></li>
-			</ul>
 		</li>
 		<li><a href="libraries.html">Libraries</a>
-			<ul>
-				<li><a href="libraries.html#authentication">Authentication</a></li>
-				<li><a href="libraries.html#cookies">Cookies</a></li>
-				<li><a href="libraries.html#dispatcher">Dispatcher</a></li>
-				<li><a href="libraries.html#serialize">Serialize</a></li>
-				<li><a href="libraries.html#session">Session</a></li>
-			</ul>
 		</li>
 		<li><strong>SAPI</strong></li>
 		<li><a href="license.html">License</a></li>
diff -pruN 5.2~alpha2-2/rockspec/cgilua-5.2-2.rockspec 6.0.2-2/rockspec/cgilua-5.2-2.rockspec
--- 5.2~alpha2-2/rockspec/cgilua-5.2-2.rockspec	1970-01-01 00:00:00.000000000 +0000
+++ 6.0.2-2/rockspec/cgilua-5.2-2.rockspec	2020-07-04 15:27:37.000000000 +0000
@@ -0,0 +1,54 @@
+package = "CGILua"
+
+version = "5.2-2"
+
+source = {
+   url = "https://github.com/keplerproject/cgilua/archive/v5.2a2.tar.gz",
+   dir = "cgilua-5.2a2",
+}
+
+description = {
+   summary = "Tool for creating dynamic Web pages and manipulating data from Web forms",
+   detailed = [[
+      CGILua allows the separation of logic and data handling from the
+      generation of pages, making it easy to develop web applications with
+      Lua. CGILua can be used with a variety of Web servers and, for each
+      server, with different launchers. A launcher is responsible for the
+      interaction of CGILua and the Web server, for example using ISAPI on
+      IIS or mod_lua on Apache. 
+   ]],
+   homepage = "http://keplerproject.github.com/cgilua",
+   license = "MIT/X11",
+}
+
+dependencies = {
+   "lua >= 5.2",
+   "luafilesystem >= 1.6.0",
+}
+
+local CGILUA_LUAS = { "src/cgilua/authentication.lua", 
+      "src/cgilua/cookies.lua", 
+      "src/cgilua/dispatcher.lua", 
+      "src/cgilua/loader.lua", 
+      "src/cgilua/lp.lua", 
+      "src/cgilua/mime.lua", 
+      "src/cgilua/post.lua", 
+      "src/cgilua/readuntil.lua", 
+      "src/cgilua/serialize.lua", 
+      "src/cgilua/session.lua", 
+      "src/cgilua/urlcode.lua" }
+
+build = {
+   type = "builtin",
+   modules = {
+     cgilua = "src/cgilua/cgilua.lua"
+   },
+   copy_directories = { "examples", "doc", "tests" },
+   install = { bin = { "src/launchers/cgilua.cgi", "src/launchers/cgilua.fcgi" } }
+}
+
+for i = 1, #CGILUA_LUAS do
+    local file = CGILUA_LUAS[i]
+    local mod = "cgilua." .. file:match("^src/cgilua/([^%.]+)%.lua$")
+    build.modules[mod] = file
+end
diff -pruN 5.2~alpha2-2/rockspec/cgilua-5.2.1-1.rockspec 6.0.2-2/rockspec/cgilua-5.2.1-1.rockspec
--- 5.2~alpha2-2/rockspec/cgilua-5.2.1-1.rockspec	1970-01-01 00:00:00.000000000 +0000
+++ 6.0.2-2/rockspec/cgilua-5.2.1-1.rockspec	2020-07-04 15:27:37.000000000 +0000
@@ -0,0 +1,55 @@
+package = "CGILua"
+
+version = "5.2.1-1"
+
+source = {
+   url = "https://github.com/keplerproject/cgilua/archive/v5.2.1.tar.gz",
+   dir = "cgilua-5.2.1",
+   md5 = "2125c0d4b583672463f2417555590e0d",
+}
+
+description = {
+   summary = "Tool for creating dynamic Web pages and manipulating data from Web forms",
+   detailed = [[
+      CGILua allows the separation of logic and data handling from the
+      generation of pages, making it easy to develop web applications with
+      Lua. CGILua can be used with a variety of Web servers and, for each
+      server, with different launchers. A launcher is responsible for the
+      interaction of CGILua and the Web server, for example using ISAPI on
+      IIS or mod_lua on Apache. 
+   ]],
+   homepage = "http://keplerproject.github.com/cgilua",
+   license = "MIT/X11",
+}
+
+dependencies = {
+   "lua >= 5.2",
+   "luafilesystem >= 1.6.0",
+}
+
+local CGILUA_LUAS = { "src/cgilua/authentication.lua", 
+      "src/cgilua/cookies.lua", 
+      "src/cgilua/dispatcher.lua", 
+      "src/cgilua/loader.lua", 
+      "src/cgilua/lp.lua", 
+      "src/cgilua/mime.lua", 
+      "src/cgilua/post.lua", 
+      "src/cgilua/readuntil.lua", 
+      "src/cgilua/serialize.lua", 
+      "src/cgilua/session.lua", 
+      "src/cgilua/urlcode.lua" }
+
+build = {
+   type = "builtin",
+   modules = {
+     cgilua = "src/cgilua/cgilua.lua"
+   },
+   copy_directories = { "examples", "doc", "tests" },
+   install = { bin = { "src/launchers/cgilua.cgi", "src/launchers/cgilua.fcgi" } }
+}
+
+for i = 1, #CGILUA_LUAS do
+    local file = CGILUA_LUAS[i]
+    local mod = "cgilua." .. file:match("^src/cgilua/([^%.]+)%.lua$")
+    build.modules[mod] = file
+end
diff -pruN 5.2~alpha2-2/rockspec/cgilua-6.0.0-0.rockspec 6.0.2-2/rockspec/cgilua-6.0.0-0.rockspec
--- 5.2~alpha2-2/rockspec/cgilua-6.0.0-0.rockspec	1970-01-01 00:00:00.000000000 +0000
+++ 6.0.2-2/rockspec/cgilua-6.0.0-0.rockspec	2020-07-04 15:27:37.000000000 +0000
@@ -0,0 +1,55 @@
+package = "CGILua"
+version = "6.0.0-0"
+
+source = {
+    url = "https://github.com/keplerproject/cgilua",
+    dir = "cgilua-6.0.0-0",
+}
+
+description = {
+    summary = "Tool for creating dynamic Web pages and manipulating data from Web forms",
+    detailed = [[
+        CGILua allows the separation of logic and data handling from the
+        generation of pages, making it easy to develop web applications with
+        Lua. CGILua can be used with a variety of Web servers and, for each
+        server, with different launchers. A launcher is responsible for the
+        interaction of CGILua and the Web server, for example using ISAPI on
+        IIS or mod_lua on Apache. 
+    ]],
+    homepage = "http://keplerproject.github.com/cgilua",
+    license = "MIT/X11",
+}
+
+dependencies = {
+    "lua >= 5.2",
+    "luafilesystem >= 1.6.0",
+}
+
+build = {
+    type = "builtin",
+    modules = {
+        ["cgilua.main"] = "src/cgilua/main.lua",
+        ["cgilua.authentication"] = "src/cgilua/authentication.lua", 
+        ["cgilua.cookies"] = "src/cgilua/cookies.lua", 
+        ["cgilua.dispatcher"] = "src/cgilua/dispatcher.lua", 
+        ["cgilua.loader"] = "src/cgilua/loader.lua", 
+        ["cgilua.lp"] = "src/cgilua/lp.lua", 
+        ["cgilua.mime"] = "src/cgilua/mime.lua", 
+        ["cgilua.post"] = "src/cgilua/post.lua", 
+        ["cgilua.readuntil"] = "src/cgilua/readuntil.lua", 
+        ["cgilua.serialize"] = "src/cgilua/serialize.lua", 
+        ["cgilua.session"] = "src/cgilua/session.lua", 
+        ["cgilua.urlcode"] = "src/cgilua/urlcode.lua"
+    },
+    install = { 
+        bin = { 
+            "src/launchers/cgilua.cgi", 
+            "src/launchers/cgilua.fcgi",
+        },
+    },
+    copy_directories = { 
+        "examples",
+        "doc",
+        "tests"
+    },
+}
diff -pruN 5.2~alpha2-2/rockspec/cgilua-6.0.1-0.rockspec 6.0.2-2/rockspec/cgilua-6.0.1-0.rockspec
--- 5.2~alpha2-2/rockspec/cgilua-6.0.1-0.rockspec	1970-01-01 00:00:00.000000000 +0000
+++ 6.0.2-2/rockspec/cgilua-6.0.1-0.rockspec	2020-07-04 15:27:37.000000000 +0000
@@ -0,0 +1,55 @@
+package = "CGILua"
+version = "6.0.1-0"
+
+source = {
+    url = "https://github.com/keplerproject/cgilua",
+    dir = "cgilua-6.0.1-0",
+}
+
+description = {
+    summary = "Tool for creating dynamic Web pages and manipulating data from Web forms",
+    detailed = [[
+        CGILua allows the separation of logic and data handling from the
+        generation of pages, making it easy to develop web applications with
+        Lua. CGILua can be used with a variety of Web servers and, for each
+        server, with different launchers. A launcher is responsible for the
+        interaction of CGILua and the Web server, for example using ISAPI on
+        IIS or mod_lua on Apache. 
+    ]],
+    homepage = "http://keplerproject.github.com/cgilua",
+    license = "MIT/X11",
+}
+
+dependencies = {
+    "lua >= 5.2",
+    "luafilesystem >= 1.6.0",
+}
+
+build = {
+    type = "builtin",
+    modules = {
+        ["cgilua.main"] = "src/cgilua/main.lua",
+        ["cgilua.authentication"] = "src/cgilua/authentication.lua", 
+        ["cgilua.cookies"] = "src/cgilua/cookies.lua", 
+        ["cgilua.dispatcher"] = "src/cgilua/dispatcher.lua", 
+        ["cgilua.loader"] = "src/cgilua/loader.lua", 
+        ["cgilua.lp"] = "src/cgilua/lp.lua", 
+        ["cgilua.mime"] = "src/cgilua/mime.lua", 
+        ["cgilua.post"] = "src/cgilua/post.lua", 
+        ["cgilua.readuntil"] = "src/cgilua/readuntil.lua", 
+        ["cgilua.serialize"] = "src/cgilua/serialize.lua", 
+        ["cgilua.session"] = "src/cgilua/session.lua", 
+        ["cgilua.urlcode"] = "src/cgilua/urlcode.lua"
+    },
+    install = { 
+        bin = { 
+            "src/launchers/cgilua.cgi", 
+            "src/launchers/cgilua.fcgi",
+        },
+    },
+    copy_directories = { 
+        "examples",
+        "doc",
+        "tests"
+    },
+}
diff -pruN 5.2~alpha2-2/src/cgilua/authentication.lua 6.0.2-2/src/cgilua/authentication.lua
--- 5.2~alpha2-2/src/cgilua/authentication.lua	2013-08-09 13:09:14.000000000 +0000
+++ 6.0.2-2/src/cgilua/authentication.lua	2020-07-04 15:27:37.000000000 +0000
@@ -22,9 +22,9 @@ local md5=require"md5"
 local cookies = require"cgilua.cookies"
 
 local cgilua = require"cgilua"
+local urlcode = require"cgilua.urlcode"
 local string = require"string"
 local math = require"math"
-local error = error
 
 local M = {}
 
@@ -88,7 +88,7 @@ function M.username()
 		if configuration.tokenPersistence == "url" then
             token = M.getToken()
 		elseif configuration.tokenPersistence == "cookie" then
-			token = cgilua.cookies.get(configuration.tokenName)
+			token = cookies.get(configuration.tokenName)
 		end
         if token then
             authenticatedUserData = md5.decrypt(M.decodeURLbase64(token), configuration.criptKey)
@@ -119,9 +119,9 @@ local function setUser(username)
         local cryptedUserData = cryptUserData()
         if configuration.tokenPersistence == "url" then
             M.setToken(cryptedUserData)
-            cgilua.cookies.delete(configuration.tokenName) -- removes an eventual previous cookie token
+            cookies.delete(configuration.tokenName) -- removes an eventual previous cookie token
         elseif configuration.tokenPersistence == "cookie" then
-            cgilua.cookies.set(configuration.tokenName, cryptedUserData)
+            cookies.set(configuration.tokenName, cryptedUserData)
             M.setToken() -- remove an eventual previous token from the URLs
         end
     end
@@ -130,7 +130,7 @@ end
 -- User logout, clear everything
 function M.logout()
     setUser()
-    cgilua.cookies.delete(configuration.tokenName)
+    cookies.delete(configuration.tokenName)
     M.setToken()
     cgilua.QUERY.logout = nil
 end
@@ -171,7 +171,7 @@ function M.checkURL(ref, tologout)
     if configuration.tokenPersistence == "url" then
         token = M.getToken()
     elseif configuration.tokenPersistence == "cookie" then
-        token = cgilua.cookies.get(configuration.tokenName)
+        token = cookies.get(configuration.tokenName)
     end
 
     -- As HTTP header referer information can violate privacy, 
@@ -197,8 +197,8 @@ end
 function M.refURL()
     local url
     local baseURL = cgilua.QUERY.ref or configuration.checkURL
-    if string.find(baseURL, "\?") then
-        url = string.gsub(baseURL, "\?", "?"..configuration.tokenName.."="..cryptUserData().."&")
+    if string.find(baseURL, "%?") then
+        url = string.gsub(baseURL, "%?", "?"..configuration.tokenName.."="..cryptUserData().."&")
     else
         url = baseURL.."?"..configuration.tokenName.."="..cryptUserData()
     end
diff -pruN 5.2~alpha2-2/src/cgilua/cgilua.lua 6.0.2-2/src/cgilua/cgilua.lua
--- 5.2~alpha2-2/src/cgilua/cgilua.lua	2013-08-09 13:09:14.000000000 +0000
+++ 6.0.2-2/src/cgilua/cgilua.lua	1970-01-01 00:00:00.000000000 +0000
@@ -1,648 +0,0 @@
-----------------------------------------------------------------------------
--- CGILua library.
---
--- @release $Id: cgilua.lua,v 1.85 2009/06/28 22:42:34 tomas Exp $
-----------------------------------------------------------------------------
-
-local _G = assert(_G)
-local urlcode = require"cgilua.urlcode"
-local lp = require"cgilua.lp"
-local lfs = require"lfs"
-local debug = require"debug"
-local assert, error, ipairs, select, tostring, type, unpack, xpcall = assert, error, ipairs, select, tostring, type, unpack, xpcall
-local pairs = pairs
-local gsub, format, strfind, strlower, strsub, match = string.gsub, string.format, string.find, string.lower, string.sub, string.match
-local setmetatable = setmetatable
-local _open = io.open
-local tinsert, tremove, concat = table.insert, table.remove, table.concat
-local date = os.date
-local os_tmpname = os.tmpname
-local getenv = os.getenv
-local remove = os.remove
-local seeall = package.seeall
-
-lp.setoutfunc ("cgilua.put")
-lp.setcompatmode (true)
-
-
-local M = {
-	_COPYRIGHT = "Copyright (C) 2003-2013 Kepler Project",
-	_DESCRIPTION = "CGILua is a tool for creating dynamic Web pages and manipulating input data from forms",
-	_VERSION = "CGILua 5.2",
-}
-
---
--- Internal state variables.
-local SAPI
-local _default_errorhandler = debug.traceback
-local _errorhandler = _default_errorhandler
-local _default_erroroutput = function (msg)
-	if type(msg) ~= "string" and type(msg) ~= "number" then
-		msg = format ("bad argument #1 to 'error' (string expected, got %s)", type(msg))
-	end
-  
-	-- Logging error
-	SAPI.Response.errorlog (msg)
-	SAPI.Response.errorlog (" ")
-
-	SAPI.Response.errorlog (SAPI.Request.servervariable"REMOTE_ADDR")
-	SAPI.Response.errorlog (" ")
-
-	SAPI.Response.errorlog (date())
-	SAPI.Response.errorlog ("\n")
-
-	-- Building user message
-	msg = gsub (gsub (msg, "\n", "<br>\n"), "\t", "&nbsp;&nbsp;")
-	SAPI.Response.contenttype ("text/html")
-	SAPI.Response.write ("<html><head><title>CGILua Error</title></head><body>" .. msg .. "</body></html>")
-end
-local _erroroutput = _default_erroroutput
-local _default_maxfilesize = 512 * 1024
-local _maxfilesize = _default_maxfilesize
-local _default_maxinput = 1024 * 1024
-local _maxinput = _default_maxinput
-M.script_path = false
-
---
--- Header functions
-
-----------------------------------------------------------------------------
--- Sends a header.
--- @name header
--- @class function
--- @param header String with the header.
--- @param value String with the corresponding value.
-----------------------------------------------------------------------------
-function M.header (...)
-	return SAPI.Response.header (...)
-end
-
-----------------------------------------------------------------------------
--- Sends a Content-type header.
--- @param type String with the type of the header.
--- @param subtype String with the subtype of the header.
-----------------------------------------------------------------------------
-function M.contentheader (type, subtype)
-	SAPI.Response.contenttype (type..'/'..subtype)
-end
-
-----------------------------------------------------------------------------
--- Sends the HTTP header "text/html".
-----------------------------------------------------------------------------
-function M.htmlheader()
-	SAPI.Response.contenttype ("text/html")
-end
-
-----------------------------------------------------------------------------
--- Sends an HTTP header redirecting the browser to another URL
--- @param url String with the URL.
--- @param args Table with the arguments (optional).
-----------------------------------------------------------------------------
-function M.redirect (url, args)
-	if strfind(url,"^https?:") then
-		local params=""
-		if args then
-			params = "?"..urlcode.encodetable(args)
-		end
-		return SAPI.Response.redirect(url..params)
-	else
-		return SAPI.Response.redirect(M.mkabsoluteurl(M.mkurlpath(url,args)))
-	end
-end
-
-----------------------------------------------------------------------------
--- Returns a server variable
--- @name servervariable
--- @class function
--- @param name String with the name of the server variable.
--- @return String with the value of the server variable.
-----------------------------------------------------------------------------
-function M.servervariable (...)
-	return SAPI.Request.servervariable (...)
-end
-
-----------------------------------------------------------------------------
--- Primitive error output function
--- @param msg String (or number) with the message.
--- @param level String with the error level (optional).
-----------------------------------------------------------------------------
-function M.errorlog (msg, level)
-	local t = type(msg)
-	if t == "string" or t == "number" then
-		SAPI.Response.errorlog (msg, level)
-	else
-		error ("bad argument #1 to `cgilua.errorlog' (string expected, got "..t..")", 2)
-	end
-end
-
-----------------------------------------------------------------------------
--- Converts all its arguments to strings before sending them to the server.
-----------------------------------------------------------------------------
-function M.print (...)
-	local args = { ... }
-	for i = 1, select("#",...) do
-		args[i] = tostring(args[i])
-	end
-	SAPI.Response.write (concat(args,"\t"))
-	SAPI.Response.write ("\n")
-end
-
-----------------------------------------------------------------------------
--- Function 'put' sends its arguments (basically strings of HTML text)
---  to the server
--- Its basic implementation is to use Lua function 'write', which writes
---  each of its arguments (strings or numbers) to file _OUTPUT (a file
---  handle initialized with the file descriptor for stdout)
--- @name put
--- @class function
--- @param s String (or number) with output.
-----------------------------------------------------------------------------
-function M.put (...)
-	return SAPI.Response.write (...)
-end
-
--- Returns the current errorhandler
-function M._geterrorhandler(msg)
-	return _errorhandler(msg)
-end
-
-----------------------------------------------------------------------------
--- Executes a function using the CGILua error handler.
--- @param f Function to be called.
-----------------------------------------------------------------------------
-function M.pcall (f)
-	local results = {xpcall (f, _errorhandler)}
-	local ok = results[1]
-	tremove(results, 1)
-	if ok then
-		if #results == 0 then results = { true } end
-		return unpack(results)
-	else
-		_erroroutput (unpack(results))
-	end
-end
-
-local function buildscriptenv()
-	local env = { cgilua = M, print = M.print, write = M.put }
-	setmetatable(env, { __index = _G, __newindex = _G })
-	return env
-end
-
-----------------------------------------------------------------------------
--- Execute a script
---  If an error is found, Lua's error handler is called and this function
---  does not return
--- @param filename String with the name of the file to be processed.
--- @return The result of the execution of the file.
-----------------------------------------------------------------------------
-function M.doscript (filename)
-	local env = buildscriptenv()
-	local f, err = loadfile(filename, "bt", env)
-	if not f then
-		error (format ("Cannot execute `%s'. Exiting.\n%s", filename, err))
-	else
-		return M.pcall(f)
-	end
-end
-
-----------------------------------------------------------------------------
--- Execute the file if there is no "file error".
---  If an error is found, and it is not a "file error", Lua 'error'
---  is called and this function does not return
--- @param filename String with the name of the file to be processed.
--- @return The result of the execution of the file or nil (in case the
---      file does not exists or if it cannot be opened).
--- @return It could return an error message if the file cannot be opened.
-----------------------------------------------------------------------------
-function M.doif (filename)
-        if not filename then return end    -- no file
-        local f, err = _open(filename)
-        if not f then return nil, err end    -- no file (or unreadable file)
-        f:close()
-        return M.doscript (filename)
-end
-
----------------------------------------------------------------------------
--- Set the maximum "total" input size allowed (in bytes)
--- @param nbytes Number of the maximum size (in bytes) of the whole POST data.
----------------------------------------------------------------------------
-function M.setmaxinput(nbytes)
-        _maxinput = nbytes
-end
-
----------------------------------------------------------------------------
--- Set the maximum size for an "uploaded" file (in bytes)
--- Might be less or equal than _maxinput.
--- @param nbytes Number of the maximum size (in bytes) of a file.
----------------------------------------------------------------------------
-function M.setmaxfilesize(nbytes)
-        _maxfilesize = nbytes
-end
-
-
--- Default path for temporary files
-M.tmp_path = CGILUA_TMP or getenv("TEMP") or getenv ("TMP") or "/tmp"
-
--- Default function for temporary names
--- @returns a temporay name using os.tmpname
-function M.tmpname ()
-    local tempname = os_tmpname()
-    -- Lua os.tmpname returns a full path in Unix, but not in Windows
-    -- so we strip the eventual prefix
-    tempname = gsub(tempname, "(/tmp/)", "")
-    return tempname
-end
-
-local _tmpfiles = {}
-
----------------------------------------------------------------------------
--- Returns a temporary file in a directory using a name generator
--- @param dir Base directory for the temporary file
--- @param namefunction Name generator function
----------------------------------------------------------------------------
-function M.tmpfile(dir, namefunction)
-	dir = dir or M.tmp_path
-	namefunction = namefunction or M.tmpname
-	local tempname = namefunction()
-	local filename = dir.."/"..tempname
-	local file, err = _open(filename, "w+b")
-	if file then
-		tinsert(_tmpfiles, {name = filename, file = file})
-	end
-	return file, err
-end
-
-
-----------------------------------------------------------------------------
--- Preprocess the content of a mixed HTML file and output a complete
---   HTML document ( a 'Content-type' header is inserted before the
---   preprocessed HTML )
--- @param filename String with the name of the file to be processed.
--- @param env Optional environment
-----------------------------------------------------------------------------
-function M.handlelp (filename, env)
-	env = env or buildscriptenv()
-	M.htmlheader ()
-	lp.include (filename, env)
-end
-
-----------------------------------------------------------------------------
--- Builds a handler that sends a header and the contents of the given file.
--- Sends the contents of the file to the output without processing it.
--- @param type String with the type of the header.
--- @param subtype String with the subtype of the header.
--- @return Function (which receives a filename as argument) that produces
---      the header and copies the content of the given file.
-----------------------------------------------------------------------------
-function M.buildplainhandler (type, subtype)
-	return function (filename)
-		local fh, err = _open (filename, "rb")
-		local contents = ""
-		if fh then
-			contents = fh:read("*a")
-			fh:close()
-		else
-			error(err)
-		end
-		M.header("Content-Lenght", #contents)
-		M.contentheader (type, subtype)
-		M.put (contents)
-	end
-end
-
-----------------------------------------------------------------------------
--- Builds a handler that sends a header and the processed file.
--- Processes the file as a Lua Page.
--- @param type String with the type of the header.
--- @param subtype String with the subtype of the header.
--- @return Function (which receives a filename as argument) that produces
---      the header and processes the given file.
-----------------------------------------------------------------------------
-function M.buildprocesshandler (type, subtype)
-	return function (filename)
-		local env = buildscriptenv()
-		M.contentheader (type, subtype)
-		lp.include (filename, env)
-	end
-end
-
-----------------------------------------------------------------------------
--- Builds the default handler table from cgilua.mime
-----------------------------------------------------------------------------
-local function buildhandlers()
-	local mime = require "cgilua.mime"
-	for ext, mediatype in pairs(mime) do
-		local t, st = match(mediatype, "([^/]*)/([^/]*)")
-		M.addscripthandler(ext, M.buildplainhandler(t, st))
-	end
-end
-
-----------------------------------------------------------------------------
--- Create an URL path to be used as a link to a CGILua script
--- @param script String with the name of the script.
--- @param args Table with arguments to script (optional).
--- @return String in URL format.
-----------------------------------------------------------------------------
-function M.mkurlpath (script, args)
-	-- URL-encode the parameters to be passed do the script
-	local params = ""
-	if args then
-		params = "?"..urlcode.encodetable(args)
-	end
-	if strsub(script,1,1) == '/' or M.script_vdir == '/' then
-		return script .. params
-	else
-		return M.script_vdir .. script .. params
-	end
-end
-
-----------------------------------------------------------------------------
--- Create an absolute URL containing the given URL path
--- @param path String with the path.
--- @param protocol String with the name of the protocol (default = "http").
--- @return String in URL format.
-----------------------------------------------------------------------------
-function M.mkabsoluteurl (path, protocol)
-	protocol = protocol or "http"
-	if path:sub(1,1) ~= '/' then
-		path = '/'..path
-	end
-	return format("%s://%s:%s%s",
-		protocol,
-		M.servervariable"SERVER_NAME",
-		M.servervariable"SERVER_PORT",
-		path)
-end
-
-----------------------------------------------------------------------------
--- Extract the "directory" and "file" parts of a path
--- @param path String with a path.
--- @return String with the directory part.
--- @return String with the file part.
-----------------------------------------------------------------------------
-function M.splitonlast (path, sep)
-	local dir,file = match(path,"^(.-)([^:/\\]*)$")
-	return dir,file
-end
-
-M.splitpath = M.splitonlast -- compatibility with previous versions
-
-----------------------------------------------------------------------------
--- Extracts the first and remaining parts of a path
--- @param path separator (defaults to "/")
--- @return String with the extracted part.
--- @return String with the remaining path.
-----------------------------------------------------------------------------
-function M.splitonfirst(path, sep)
-	local first, rest = match(path, "^/([^:/\\]*)(.*)")
-	return first, rest
-end
-
---
--- Define variables and build the cgilua.POST, cgilua.GET tables.
---
-local function getparams ()
-    local requestmethod = M.servervariable"REQUEST_METHOD"
-	-- Fill in the POST table.
-	M.POST = {}
-	if  requestmethod == "POST" then
-		M.post.parsedata {
-			read = SAPI.Request.getpostdata,
-			discardinput = ap and ap.discard_request_body,
-			content_type = M.servervariable"CONTENT_TYPE",
-			content_length = M.servervariable"CONTENT_LENGTH",
-			maxinput = _maxinput,
-			maxfilesize = _maxfilesize,
-			args = M.POST,
-		}
-	end
-	-- Fill in the QUERY table.
-	M.QUERY = {}
-	urlcode.parsequery (M.servervariable"QUERY_STRING", M.QUERY)
-end
-
---
--- Stores all script handlers and the file extensions used to identify
--- them. Loads the default 
-local _script_handlers = {}
---
--- Default handler.
--- Sends the contents of the file to the output without processing it.
--- This relies in the browser being able to discover the content type
--- which is not reliable.
--- @param filename String with the name of the file.
---
-local function default_handler (filename)
-	local fh, err = _open (filename, "rb")
-	local contents
-	if fh then
-		contents = fh:read("*a")
-		fh:close()
-	else
-		error(err)
-	end
-	M.header("Content-Lenght", #contents)
-	M.put ("\n")
-	M.put (contents)
-end
-
-----------------------------------------------------------------------------
--- Add a script handler.
--- @param file_extension String with the lower-case extension of the script.
--- @param func Function to handle this kind of scripts.
-----------------------------------------------------------------------------
-function M.addscripthandler (file_extension, func)
-	assert (type(file_extension) == "string", "File extension must be a string")
-	if strfind (file_extension, '%.', 1) then
-		file_extension = strsub (file_extension, 2)
-	end
-	file_extension = strlower(file_extension)
-	assert (type(func) == "function", "Handler must be a function")
-
-	_script_handlers[file_extension] = func
-end
-
----------------------------------------------------------------------------
--- Obtains the handler corresponding to the given script path.
--- @param path String with a script path.
--- @return Function that handles it or nil.
-----------------------------------------------------------------------------
-function M.getscripthandler (path)
-	local i,f, ext = strfind (path, "%.([^.]+)$")
-	return _script_handlers[strlower(ext or '')]
-end
-
----------------------------------------------------------------------------
--- Execute the given path with the corresponding handler.
--- @param path String with a script path.
--- @return The returned values from the script.
----------------------------------------------------------------------------
-function M.handle (path)
-	local h = M.getscripthandler (path) or default_handler
-	return h (path)
-end
-
----------------------------------------------------------------------------
--- Sets "errorhandler" function
--- This function is called by Lua when an error occurs.
--- It receives the error message generated by Lua and it is resposible
--- for the final message which should be returned.
--- @param Function.
----------------------------------------------------------------------------
-function M.seterrorhandler (f)
-	local tf = type(f)
-	if tf == "function" then
-		_errorhandler = f
-	else
-		error (format ("Invalid type: expected `function', got `%s'", tf))
-	end
-end
-
----------------------------------------------------------------------------
--- Defines the "erroroutput" function
--- This function is called to generate the error output.
--- @param Function.
----------------------------------------------------------------------------
-function M.seterroroutput (f)
-	local tf = type(f)
-	if tf == "function" then
-		_erroroutput = f
-	else
-		error (format ("Invalid type: expected `function', got `%s'", tf))
-	end
-end
-
---
--- Stores all close functions in order they are set.
-local _close_functions = {
-}
-
----------------------------------------------------------------------------
--- Adds a function to be executed after the script.
--- @param f Function to be registered.
----------------------------------------------------------------------------
-function M.addclosefunction (f)
-	local tf = type(f)
-	if tf == "function" then
-		tinsert (_close_functions, f)
-	else
-		error (format ("Invalid type: expected `function', got `%s'", tf))
-	end
-end
-
---
--- Close function.
---
-local function close()
-	for i = #_close_functions, 1, -1 do
-		_close_functions[i]()
-	end
-end
-
---
--- Stores all open functions in order they are set.
-local _open_functions = {
-}
-
----------------------------------------------------------------------------
--- Adds a function to be executed before the script.
--- @param f Function to be registered.
----------------------------------------------------------------------------
-function M.addopenfunction (f)
-	local tf = type(f)
-	if tf == "function" then
-		tinsert (_open_functions, f)
-	else
-		error (format ("Invalid type: expected `function', got `%s'", tf))
-	end
-end
-
---
--- Open function.
--- Call all defined open-functions in the order they were created.
---
-local function open()
-	for i = #_open_functions, 1, -1 do
-		_open_functions[i]()
-	end
-end
-
---
--- Resets CGILua's state.
---
-local function reset ()
-	M.script_path = false
-	M.script_vpath, M.pdir, M.use_executable_name, M.urlpath, M.script_vdir, M.script_pdir,
-	M.script_file, M.authentication, M.app_name = 
-		nil, nil, nil, nil, nil, nil, nil, nil, nil
-	_maxfilesize = _default_maxfilesize
-	_maxinput = _default_maxinput
-	-- Error Handling
-	_errorhandler = _default_errorhandler
-	_erroroutput = _default_erroroutput
-	-- Handlers
-	_script_handlers = {}
-	_open_functions = {}
-	_close_functions = {}
-	-- clean temporary files
-	for i, v in ipairs(_tmpfiles) do
-		_tmpfiles[i] = nil
-		v.file:close()
-		local _, err = remove(v.name)
-		if err then
-			error(err)
-		end
-	end
-end
-
----------------------------------------------------------------------------
--- Request processing.
----------------------------------------------------------------------------
-function M.main ()
-	SAPI = _G.SAPI
-	buildhandlers()    
-	-- Default handler values
-	M.addscripthandler ("lua", M.doscript)
-	M.addscripthandler ("lp", M.handlelp)
-	-- Looks for an optional loader module
-	M.pcall (function () M.loader = require"cgilua.loader" end)
-
-	-- post.lua needs to be loaded after cgilua.lua is compiled
-	M.pcall (function () M.post = require"cgilua.post" end)
-
-	if M.loader then
-		M.loader.init()
-	end
-    
-	-- Build QUERY/POST tables
-	if not M.pcall (getparams) then return nil end
-
-	local result
-	-- Executes the optional loader module
-	if M.loader then
-		M.loader.run()
-	end
-
-	-- Changing curent directory to the script's "physical" dir
-	local curr_dir = lfs.currentdir ()
-	M.pcall (function () lfs.chdir (M.script_pdir) end)
-
-	-- Opening functions
-	M.pcall (open)
-
-	-- Executes the script
-	result, err = M.pcall (function () return M.handle (M.script_file) end)
-    
-	-- Closing functions
-	M.pcall (close)
-	-- Changing to original directory
-	M.pcall (function () lfs.chdir (curr_dir) end)
-
-	-- Cleanup
-	reset ()
-	if result then -- script executed ok!
-		return result
-	end
-end
-
-return M
diff -pruN 5.2~alpha2-2/src/cgilua/cookies.lua 6.0.2-2/src/cgilua/cookies.lua
--- 5.2~alpha2-2/src/cgilua/cookies.lua	2013-08-09 13:09:14.000000000 +0000
+++ 6.0.2-2/src/cgilua/cookies.lua	2020-07-04 15:27:37.000000000 +0000
@@ -4,19 +4,19 @@
 -- @release $Id: cookies.lua,v 1.8 2008/04/24 13:42:04 mascarenhas Exp $
 ----------------------------------------------------------------------------
 
-local cgilua = require"cgilua"
 local os = require"os"
 local string = require"string"
 local urlcode = require"cgilua.urlcode"
+local cgilua = require"cgilua"
 
 local error = error
-local format, gsub, strfind = string.format, string.gsub, string.find
+local format, gsub, strfind, strmatch = string.format, string.gsub, string.find, string.match
 local date = os.date
 local escape, unescape = urlcode.escape, urlcode.unescape
 
-local header = SAPI.Response.header
-local write = SAPI.Response.write
-local servervariable = SAPI.Request.servervariable
+local header = cgilua.Response.header
+local write = cgilua.Response.write
+local servervariable = cgilua.servervariable
 
 local M = {}
 
@@ -81,7 +81,7 @@ function M.get (name)
 	cookies = ";" .. cookies .. ";"
 	cookies = gsub(cookies, "%s*;%s*", ";")	 -- remove extra spaces
 	local pattern = ";" .. name .. "=(.-);"
-	local _, __, value = strfind(cookies, pattern)
+	local value = strmatch(cookies, pattern)
 	return value and unescape(value)
 end
 
diff -pruN 5.2~alpha2-2/src/cgilua/dispatcher.lua 6.0.2-2/src/cgilua/dispatcher.lua
--- 5.2~alpha2-2/src/cgilua/dispatcher.lua	2013-08-09 13:09:14.000000000 +0000
+++ 6.0.2-2/src/cgilua/dispatcher.lua	2020-07-04 15:27:37.000000000 +0000
@@ -1,6 +1,9 @@
 -- CGILua dispatcher module
 -- @release $Id: dispatcher.lua,v 1.8 2007/12/07 18:49:49 carregal Exp $
 
+local cgilua = require"cgilua"
+local urlcode = require"cgilua.urlcode"
+local unpack = table.unpack or unpack
 
 -- Checks if an URL matches a route pattern
 local function route_match(url, pattern) 
@@ -35,7 +38,7 @@ end
 local function route_url(map_name, params, queryargs)
 	local queryparams = ""
 	if queryargs then
-		queryparams = "?"..cgilua.urlcode.encodetable(queryargs)
+		queryparams = "?"..urlcode.encodetable(queryargs)
 	end
 	for i, v in ipairs(route_URLs) do
         local pattern, f, name = unpack(v)
@@ -59,7 +62,7 @@ local function route(URLs)
 		URLs = {URLs}
 	end
     route_URLs = URLs
-    f, args = route_map(cgilua.script_vpath)
+    local f, args = route_map(cgilua.script_vpath)
 
     if f then
         return f(args)
diff -pruN 5.2~alpha2-2/src/cgilua/lp.lua 6.0.2-2/src/cgilua/lp.lua
--- 5.2~alpha2-2/src/cgilua/lp.lua	2013-08-09 13:09:14.000000000 +0000
+++ 6.0.2-2/src/cgilua/lp.lua	2020-07-04 15:27:37.000000000 +0000
@@ -4,7 +4,8 @@
 -- @release $Id: lp.lua,v 1.15 2008/12/11 17:40:24 mascarenhas Exp $
 ----------------------------------------------------------------------------
 
-local assert, error, loadstring = assert, error, loadstring
+local assert, error = assert, error
+local load = loadstring or load
 local find, format, gsub, strsub, char = string.find, string.format, string.gsub, string.sub, string.char
 local concat, tinsert = table.concat, table.insert
 local open = io.open
@@ -101,13 +102,16 @@ local cache = {}
 -- @return Function with the resulting translation.
 
 function M.compile (string, chunkname, env)
-	local s, err = cache[string]
+	local s = cache[string]
 	if not s then
 		s = M.translate (string)
 		cache[string] = s
 	end
-	f, err = load (s, chunkname, "bt", env)
+	local f, err = load (s, chunkname, "bt", env)
 	if not f then error (err, 3) end
+	if _VERSION == "Lua 5.1" then
+		setfenv(f, env)
+	end
 	return f
 end
 
diff -pruN 5.2~alpha2-2/src/cgilua/main.lua 6.0.2-2/src/cgilua/main.lua
--- 5.2~alpha2-2/src/cgilua/main.lua	1970-01-01 00:00:00.000000000 +0000
+++ 6.0.2-2/src/cgilua/main.lua	2020-07-04 15:27:37.000000000 +0000
@@ -0,0 +1,749 @@
+----------------------------------------------------------------------------
+-- CGILua library.
+--
+-- @release $Id: cgilua.lua,v 1.85 2009/06/28 22:42:34 tomas Exp $
+----------------------------------------------------------------------------
+
+local urlcode = require"cgilua.urlcode"
+local lp = require"cgilua.lp"
+local lfs = require"lfs"
+local debug = require"debug"
+local assert, error, ipairs, select, tostring, type, xpcall = assert, error, ipairs, select, tostring, type, xpcall
+local unpack = table.unpack or unpack
+local pairs = pairs
+local gsub, format, strfind, strlower, strsub, match = string.gsub, string.format, string.find, string.lower, string.sub, string.match
+local setmetatable = setmetatable
+local _open = io.open
+local tinsert, tremove, concat = table.insert, table.remove, table.concat
+local date = os.date
+local os_tmpname = os.tmpname
+local getenv = os.getenv
+local remove = os.remove
+lp.setoutfunc ("cgilua.put")
+lp.setcompatmode (true)
+
+-- Module return in first require
+local cgilua = {
+	_COPYRIGHT = "Copyright (C) 2003-2019 Kepler Project",
+	_DESCRIPTION = "CGILua is a tool for creating dynamic Web pages and manipulating input data from forms",
+	_VERSION = "CGILua 6.0",
+}
+
+-- local functions and variables
+local L = { 
+
+}
+
+
+local function build_library_objects(enviroment, response)
+	local M = {
+		_COPYRIGHT = cgilua._COPYRIGHT,
+		_DESCRIPTION = cgilua._DESCRIPTION,
+		_VERSION = cgilua._VERSION,
+	}
+	--[[
+	######################################################################
+	######################################################################
+	###################### Public ########################################
+	######################################################################
+	######################################################################
+	]]
+
+	---------------------------------------------------------------------------
+	-- gets an enviroment variable
+	---------------------------------------------------------------------------
+	M.servervariable = function (name)
+		return enviroment[name] 
+	end;
+
+	---------------------------------------------------------------------------
+	-- Build Response table
+	---------------------------------------------------------------------------
+	M.Response = {
+		contenttype = function (header)
+			response:content_type(header)
+		end,
+		errorlog = function (msg, errlevel)
+			enviroment.error:write (msg)
+		end,
+		header = function (header, value)
+			if response.headers[header] then
+				if type(response.headers[header]) == "table" then
+					table.insert(response.headers[header], value)
+				else
+					response.headers[header] = { response.headers[header], value }
+				end
+			else
+				response.headers[header] = value
+			end
+		end,
+		redirect = function (url)
+			response.status = 302
+			response.headers["Location"] = url
+		end,
+		status = response.status,
+		write = function (...)
+			response:write({...})
+		end,
+	}
+
+	---------------------------------------------------------------------------
+	-- set response status
+	---------------------------------------------------------------------------
+	M.setstatus = function (st)
+		response.status = st
+	end
+
+	---------------------------------------------------------------------------
+	-- Adds a function to be executed before the script.
+	-- @param f Function to be registered.
+	---------------------------------------------------------------------------
+	M.addopenfunction = function (f)
+		local tf = type(f)
+		if tf == "function" then
+			tinsert (L._open_functions, f)
+		else
+			error (format ("Invalid type: expected `function', got `%s'", tf))
+		end
+	end
+
+	---------------------------------------------------------------------------
+	-- Adds a function to be executed after the script.
+	-- @param f Function to be registered.
+	---------------------------------------------------------------------------
+	M.addclosefunction = function (f)
+		local tf = type(f)
+		if tf == "function" then
+			tinsert (L._close_functions, f)
+		else
+			error (format ("Invalid type: expected `function', got `%s'", tf))
+		end
+	end
+
+	----------------------------------------------------------------------------
+	-- Add a script handler.
+	-- @param file_extension String with the lower-case extension of the script.
+	-- @param func Function to handle this kind of scripts.
+	----------------------------------------------------------------------------
+	M.addscripthandler = function (file_extension, func)
+		assert (type(file_extension) == "string", "File extension must be a string")
+		if strfind(file_extension, '%.') then
+			file_extension = strsub (file_extension, 2)
+		end
+		file_extension = strlower(file_extension)
+		assert (type(func) == "function", "Handler must be a function")
+
+		L._script_handlers[file_extension] = func
+	end
+
+	---------------------------------------------------------------------------
+	-- Obtains the handler corresponding to the given script path.
+	-- @param path String with a script path.
+	-- @return Function that handles it or nil.
+	----------------------------------------------------------------------------
+	M.getscripthandler = function (path)
+		local ext = match(path, "%.([^.]+)$")
+		return L._script_handlers[strlower(ext or '')]
+	end
+
+	---------------------------------------------------------------------------
+	-- Execute the given path with the corresponding handler.
+	-- @param path String with a script path.
+	-- @return The returned values from the script.
+	---------------------------------------------------------------------------
+	M.handle = function (path)
+		local h = M.getscripthandler (path) or default_handler
+		return h (path)
+	end
+
+	---------------------------------------------------------------------------
+	-- Sets "errorhandler" function
+	-- This function is called by Lua when an error occurs.
+	-- It receives the error message generated by Lua and it is resposible
+	-- for the final message which should be returned.
+	-- @param f Function.
+	---------------------------------------------------------------------------
+	M.seterrorhandler = function (f)
+		local tf = type(f)
+		if tf == "function" then
+			L.errorhandler = f
+		else
+			error (format ("Invalid type: expected `function', got `%s'", tf))
+		end
+	end
+
+	---------------------------------------------------------------------------
+	-- Defines the "erroroutput" function
+	-- This function is called to generate the error output.
+	-- @param f Function.
+	---------------------------------------------------------------------------
+	M.seterroroutput = function (f)
+		local tf = type(f)
+		if tf == "function" then
+			L.erroroutput = f
+		else
+			error (format ("Invalid type: expected `function', got `%s'", tf))
+		end
+	end
+
+
+	---------------------------------------------------------------------------
+	-- Returns a temporary file in a directory using a name generator
+	-- @param dir Base directory for the temporary file
+	-- @param namefunction Name generator function
+	---------------------------------------------------------------------------
+	M.tmpfile = function (dir, namefunction)
+		dir = dir or M.tmp_path
+		namefunction = namefunction or M.tmpname
+		local tempname = namefunction()
+		local filename = dir.."/"..tempname
+		local file, err = _open(filename, "w+b")
+		if file then
+			tinsert(L._tmpfiles, {name = filename, file = file})
+		end
+		return file, err
+	end
+
+
+	----------------------------------------------------------------------------
+	-- Preprocess the content of a mixed HTML file and output a complete
+	--   HTML document ( a 'Content-type' header is inserted before the
+	--   preprocessed HTML )
+	-- @param filename String with the name of the file to be processed.
+	-- @param env Optional environment
+	----------------------------------------------------------------------------
+	M.handlelp = function  (filename, env)
+		env = env or L.buildscriptenv()
+		M.htmlheader ()
+		lp.include (filename, env)
+	end
+
+	----------------------------------------------------------------------------
+	-- Builds a handler that sends a header and the contents of the given file.
+	-- Sends the contents of the file to the output without processing it.
+	-- @param type String with the type of the header.
+	-- @param subtype String with the subtype of the header.
+	-- @return Function (which receives a filename as argument) that produces
+	--      the header and copies the content of the given file.
+	----------------------------------------------------------------------------
+	M.buildplainhandler = function (type, subtype)
+		return function (filename)
+			local fh, err = _open (filename, "rb")
+			local contents = ""
+			if fh then
+				contents = fh:read("*a")
+				fh:close()
+			else
+				error(err)
+			end
+			M.header("Content-Lenght", #contents)
+			M.contentheader (type, subtype)
+			M.put (contents)
+		end
+	end
+
+	----------------------------------------------------------------------------
+	-- Builds a handler that sends a header and the processed file.
+	-- Processes the file as a Lua Page.
+	-- @param type String with the type of the header.
+	-- @param subtype String with the subtype of the header.
+	-- @return Function (which receives a filename as argument) that produces
+	--      the header and processes the given file.
+	----------------------------------------------------------------------------
+	M.buildprocesshandler = function  (type, subtype)
+		return function (filename)
+			local env = L.buildscriptenv()
+			M.contentheader (type, subtype)
+			lp.include (filename, env)
+		end
+	end
+
+	----------------------------------------------------------------------------
+	-- Create an URL path to be used as a link to a CGILua script
+	-- @param script String with the name of the script.
+	-- @param args Table with arguments to script (optional).
+	-- @return String in URL format.
+	----------------------------------------------------------------------------
+	M.mkurlpath = function (script, args)
+		-- URL-encode the parameters to be passed do the script
+		local params = ""
+		if args then
+			params = "?"..urlcode.encodetable(args)
+		end
+		if strsub(script,1,1) == '/' or M.script_vdir == '/' then
+			return script .. params
+		else
+			return M.script_vdir .. script .. params
+		end
+	end
+
+	----------------------------------------------------------------------------
+	-- Create an absolute URL containing the given URL path
+	-- @param path String with the path.
+	-- @param protocol String with the name of the protocol (default = "http").
+	-- @return String in URL format.
+	----------------------------------------------------------------------------
+	M.mkabsoluteurl = function  (path, protocol)
+		protocol = protocol or "http"
+		if path:sub(1,1) ~= '/' then
+			path = '/'..path
+		end
+		return format("%s://%s:%s%s",
+			protocol,
+			M.servervariable"SERVER_NAME",
+			M.servervariable"SERVER_PORT",
+			path)
+	end
+
+	----------------------------------------------------------------------------
+	-- Extract the "directory" and "file" parts of a path
+	-- @param path String with a path.
+	-- @return String with the directory part.
+	-- @return String with the file part.
+	----------------------------------------------------------------------------
+	M.splitonlast = function  (path)
+		local dir,file = match(path,"^(.-)([^:/\\]*)$")
+		return dir,file
+	end
+
+	M.splitpath = M.splitonlast -- compatibility with previous versions
+
+	----------------------------------------------------------------------------
+	-- Extracts the first and remaining parts of a path
+	-- @return String with the extracted part.
+	-- @return String with the remaining path.
+	----------------------------------------------------------------------------
+	M.splitonfirst = function (path)
+		local first, rest = match(path, "^/([^:/\\]*)(.*)")
+		return first, rest
+	end
+
+
+	----------------------------------------------------------------------------
+	-- Execute a script
+	--  If an error is found, Lua's error handler is called and this function
+	--  does not return
+	-- @param filename String with the name of the file to be processed.
+	-- @return The result of the execution of the file.
+	----------------------------------------------------------------------------
+	M.doscript = function (filename)
+		local env = L.buildscriptenv()
+		local f, err = loadfile(filename, "bt", env)
+		if not f then
+			error (format ("Cannot execute `%s'. Exiting.\n%s", filename, err))
+		else
+			if _VERSION == "Lua 5.1" then
+				setfenv(f, env)
+			end
+			return M.pcall(f)
+		end
+	end
+
+	----------------------------------------------------------------------------
+	-- Execute the file if there is no "file error".
+	--  If an error is found, and it is not a "file error", Lua 'error'
+	--  is called and this function does not return
+	-- @param filename String with the name of the file to be processed.
+	-- @return The result of the execution of the file or nil (in case the
+	--      file does not exists or if it cannot be opened).
+	-- @return It could return an error message if the file cannot be opened.
+	----------------------------------------------------------------------------
+	M.doif = function (filename)
+	        if not filename then return end    -- no file
+	        local f, err = _open(filename)
+	        if not f then return nil, err end    -- no file (or unreadable file)
+	        f:close()
+	        return M.doscript (filename)
+	end
+
+	---------------------------------------------------------------------------
+	-- Set the maximum "total" input size allowed (in bytes)
+	-- @param nbytes Number of the maximum size (in bytes) of the whole POST data.
+	---------------------------------------------------------------------------
+	M.setmaxinput = function(nbytes)
+	        L.maxinput = nbytes
+	end
+
+	---------------------------------------------------------------------------
+	-- Set the maximum size for an "uploaded" file (in bytes)
+	-- Might be less or equal than L.maxinput.
+	-- @param nbytes Number of the maximum size (in bytes) of a file.
+	---------------------------------------------------------------------------
+	M.setmaxfilesize = function(nbytes)
+	        L.maxfilesize = nbytes
+	end
+
+	---------------------------------------------------------------------------
+	-- Default path for temporary files
+	---------------------------------------------------------------------------
+	M.tmp_path = CGILUA_TMP or getenv("TEMP") or getenv ("TMP") or "/tmp"
+
+	---------------------------------------------------------------------------
+	-- Default function for temporary names
+	-- @return a temporay name using os.tmpname
+	---------------------------------------------------------------------------
+	M.tmpname = function ()
+	    local tempname = os_tmpname()
+	    -- Lua os.tmpname returns a full path in Unix, but not in Windows
+	    -- so we strip the eventual prefix
+	    tempname = gsub(tempname, "(/tmp/)", "")
+	    return tempname
+	end
+
+	----------------------------------------------------------------------------
+	-- Sends a header.
+	-- @name header
+	-- @class function
+	-- @param header String with the header.
+	-- @param value String with the corresponding value.
+	----------------------------------------------------------------------------
+	M.header = function (...)
+		return M.Response.header (...)
+	end
+
+	----------------------------------------------------------------------------
+	-- Sends a Content-type header.
+	-- @param type String with the type of the header.
+	-- @param subtype String with the subtype of the header.
+	----------------------------------------------------------------------------
+	M.contentheader = function (type, subtype)
+		M.Response.contenttype (type..'/'..subtype)
+	end
+
+	----------------------------------------------------------------------------
+	-- Sends the HTTP header "text/html".
+	----------------------------------------------------------------------------
+	M.htmlheader = function ()
+		M.Response.contenttype ("text/html")
+	end
+
+	----------------------------------------------------------------------------
+	-- Sends an HTTP header redirecting the browser to another URL
+	-- @param url String with the URL.
+	-- @param args Table with the arguments (optional).
+	----------------------------------------------------------------------------
+	M.redirect = function (url, args)
+		if strfind(url,"^https?:") then
+			local params=""
+			if args then
+				params = "?"..urlcode.encodetable(args)
+			end
+			return M.Response.redirect(url..params)
+		else
+			local protocol = (M.servervariable"SERVER_PORT" == "443") and "https" or "http"
+			return M.Response.redirect(M.mkabsoluteurl(M.mkurlpath(url,args), protocol))
+		end
+	end
+
+	----------------------------------------------------------------------------
+	-- Primitive error output function
+	-- @param msg String (or number) with the message.
+	-- @param level String with the error level (optional).
+	----------------------------------------------------------------------------
+	M.errorlog = function (msg, level)
+		local t = type(msg)
+		if t == "string" or t == "number" then
+			M.Response.errorlog (msg, level)
+		else
+			error ("bad argument #1 to `cgilua.errorlog' (string expected, got "..t..")", 2)
+		end
+	end
+
+	----------------------------------------------------------------------------
+	-- Converts all its arguments to strings before sending them to the server.
+	----------------------------------------------------------------------------
+	M.print = function (...)
+		local args = { ... }
+		for i = 1, select("#",...) do
+			args[i] = tostring(args[i])
+		end
+		M.Response.write (concat(args,"\t"))
+		M.Response.write ("\n")
+	end
+
+	----------------------------------------------------------------------------
+	-- Function 'put' sends its arguments (basically strings of HTML text)
+	--  to the server
+	-- Its basic implementation is to use Lua function 'write', which writes
+	--  each of its arguments (strings or numbers) to file _OUTPUT (a file
+	--  handle initialized with the file descriptor for stdout)
+	-- @name put
+	-- @class function
+	-- @param s String (or number) with output.
+	----------------------------------------------------------------------------
+	M.put = function (...)
+		return M.Response.write (...)
+	end
+
+	----------------------------------------------------------------------------
+	-- Returns the current errorhandler
+	----------------------------------------------------------------------------
+	M._geterrorhandler = function(msg)
+		return L.errorhandler(msg)
+	end
+
+	----------------------------------------------------------------------------
+	-- Executes a function using the CGILua error handler.
+	-- @param f Function to be called.
+	----------------------------------------------------------------------------
+	M.pcall = function (f)
+		local results = {xpcall (f, L.errorhandler)}
+		local ok = results[1]
+		tremove(results, 1)
+		if ok then
+			if #results == 0 then results = { true } end
+			return unpack(results)
+		else
+			L.erroroutput (unpack(results))
+		end
+	end
+
+
+	--[[
+	######################################################################
+	######################################################################
+	###################### Local #########################################
+	######################################################################
+	######################################################################
+	]]
+
+	----------------------------------------------------------------------
+	-- Internal state variables.
+	----------------------------------------------------------------------
+	L.default_errorhandler = debug.traceback
+	L.errorhandler = L.default_errorhandler
+	L.default_erroroutput = function (msg)
+		if type(msg) ~= "string" and type(msg) ~= "number" then
+			msg = format ("bad argument #1 to 'error' (string expected, got %s)", type(msg))
+		end
+	  
+		-- Logging error
+		M.Response.errorlog (msg)
+		M.Response.errorlog (" ")
+
+		M.Response.errorlog (M.servervariable"REMOTE_ADDR")
+		M.Response.errorlog (" ")
+
+		M.Response.errorlog (date())
+		M.Response.errorlog ("\n")
+
+		-- Building user message
+		msg = gsub (gsub (msg, "\n", "<br>\n"), "\t", "&nbsp;&nbsp;")
+		M.Response.contenttype ("text/html")
+		M.Response.write ("<html><head><title>CGILua Error</title></head><body>" .. msg .. "</body></html>")
+	end
+	L.erroroutput = L.default_erroroutput
+	L.default_maxfilesize = 512 * 1024
+	L.maxfilesize = L.default_maxfilesize
+	L.default_maxinput = 1024 * 1024
+	L.maxinput = L.default_maxinput
+	L.script_path = false
+
+	----------------------------------------------------------------------
+	-- Define variables and build the cgilua.POST and cgilua.GET tables.
+	----------------------------------------------------------------------
+	L.getparams = function()
+	    local requestmethod = M.servervariable"REQUEST_METHOD"
+		-- Fill in the POST table.
+		M.POST = {}
+		if  requestmethod == "POST" then
+			M.post.parsedata {
+				read = function (n) return enviroment.input:read(n) end;
+				discardinput = ap and ap.discard_request_body,
+				content_type = M.servervariable"CONTENT_TYPE",
+				content_length = M.servervariable"CONTENT_LENGTH",
+				maxinput = L.maxinput,
+				maxfilesize = L.maxfilesize,
+				args = M.POST,
+			}
+		end
+		-- Fill in the QUERY table.
+		M.QUERY = {}
+		urlcode.parsequery (M.servervariable"QUERY_STRING", M.QUERY)
+	end
+
+	----------------------------------------------------------------------------
+	-- Builds the default handler table from cgilua.mime
+	----------------------------------------------------------------------------
+	L.buildhandlers = function()
+		local mime = require "cgilua.mime"
+		for ext, mediatype in pairs(mime) do
+			local t, st = match(mediatype, "([^/]*)/([^/]*)")
+			M.addscripthandler(ext, M.buildplainhandler(t, st))
+		end
+	end
+
+	----------------------------------------------------------------------
+	--
+	----------------------------------------------------------------------
+	L.buildscriptenv = function()
+		local env = { cgilua = M, print = M.print, write = M.put }
+		setmetatable(env, { __index = _G, __newindex = _G })
+		return env
+	end
+
+	----------------------------------------------------------------------
+	--
+	----------------------------------------------------------------------
+	L._tmpfiles = { }
+
+	----------------------------------------------------------------------
+	-- Stores all script handlers and the file extensions used to identify
+	-- them. Loads the default 
+	----------------------------------------------------------------------
+	L._script_handlers = { }
+
+	----------------------------------------------------------------------
+	-- Default handler.
+	-- Sends the contents of the file to the output without processing it.
+	-- This relies in the browser being able to discover the content type
+	-- which is not reliable.
+	-- @param filename String with the name of the file.
+	----------------------------------------------------------------------
+	L.default_handler = function (filename)
+		local fh, err = _open (filename, "rb")
+		local contents
+		if fh then
+			contents = fh:read("*a")
+			fh:close()
+		else
+			error(err)
+		end
+		M.header("Content-Lenght", #contents)
+		M.put ("\n")
+		M.put (contents)
+	end
+
+	----------------------------------------------------------------------
+	-- Stores all close functions in order they are set.
+	----------------------------------------------------------------------
+	L._close_functions = {
+	}
+
+	----------------------------------------------------------------------
+	-- Close function.
+	----------------------------------------------------------------------
+	L.close = function ()
+		for i = #L._close_functions, 1, -1 do
+			L._close_functions[i]()
+		end
+	end
+
+	----------------------------------------------------------------------
+	-- Stores all open functions in order they are set.
+	----------------------------------------------------------------------
+	L._open_functions = {
+	}
+
+	----------------------------------------------------------------------
+	-- Open function.
+	-- Call all defined open-functions in the order they were created.
+	----------------------------------------------------------------------
+	L.open = function ()
+		for i = #L._open_functions, 1, -1 do
+			L._open_functions[i]()
+		end
+	end
+
+	----------------------------------------------------------------------
+	-- Resets CGILua's state.
+	----------------------------------------------------------------------
+	L.reset = function  ()
+		L.script_path = false
+		M.script_vpath, M.pdir, M.use_executable_name, M.urlpath, M.script_vdir, M.script_pdir,
+		M.script_file, M.authentication, M.app_name = 
+			nil, nil, nil, nil, nil, nil, nil, nil, nil
+		L.maxfilesize = L.default_maxfilesize
+		L.maxinput = L.default_maxinput
+		-- Error Handling
+		L.errorhandler = L.default_errorhandler
+		L.erroroutput = L.default_erroroutput
+		-- Handlers
+		L._script_handlers = {}
+		L._open_functions = {}
+		L._close_functions = {}
+		-- clean temporary files
+		for i, v in ipairs(L._tmpfiles) do
+			L._tmpfiles[i] = nil
+			v.file:close()
+			local _, err = remove(v.name)
+			if err then
+				error(err)
+			end
+		end
+		M.Response = nil;
+	end
+
+	return M;
+end
+
+
+---------------------------------------------------------------------------
+-- Request processing.
+-- env: enviroment variables
+-- response: the response object
+---------------------------------------------------------------------------
+function cgilua.main (enviroment, response)
+	--validade response parameter
+	assert(type(response) == "table", "invalid parameter: response")
+	assert(response.content_type, "invalid parameter: response need to have a method content_type()")
+	assert(response.write, "invalid parameter: response need to have a method write()")
+	assert(response.headers, "invalid parameter: response need to have a atribute headers")
+	assert(response.status, "invalid parameter: response need to have a atribute status")
+
+	-- enviroment variables
+	_G.CGILUA_APPS = _G.CGILUA_APPS or enviroment.DOCUMENT_ROOT .. "/cgilua"
+	_G.CGILUA_CONF = _G.CGILUA_CONF or enviroment.DOCUMENT_ROOT .. "/cgilua"
+	_G.CGILUA_TMP = _G.CGILUA_TMP or os.getenv("TMP") or os.getenv("TEMP") or "/tmp"
+	_G.CGILUA_ISDIRECT = true
+
+	-- build library objects
+    local M = build_library_objects (enviroment, response);
+    package.loaded.cgilua = M;
+
+    -- Main function
+	L.buildhandlers()
+	-- Default handler values
+	M.addscripthandler ("lua", M.doscript)
+	M.addscripthandler ("lp", M.handlelp)
+	-- Looks for an optional loader module
+	M.pcall (function () M.loader = require"cgilua.loader" end)
+
+	-- post.lua needs to be loaded after cgilua.lua is compiled
+	M.pcall (function () M.post = require"cgilua.post" end)
+
+	if M.loader then
+		M.loader.init()
+	end
+    
+	-- Build QUERY/POST tables
+	if not M.pcall (L.getparams) then return nil end
+
+	-- Executes the optional loader module
+	if M.loader then
+		M.loader.run()
+	end
+
+	-- Changing curent directory to the script's "physical" dir
+	local curr_dir = lfs.currentdir ()
+	M.pcall (function () lfs.chdir (M.script_pdir) end)
+
+	-- Opening functions
+	M.pcall (L.open)
+
+	-- Executes the script
+	-- "return" is not used anywhere
+	M.pcall (function () return M.handle (M.script_file) end)
+    
+	-- Closing functions
+	M.pcall (L.close)
+	-- Changing to original directory
+	M.pcall (function () lfs.chdir (curr_dir) end)
+
+	-- Cleanup
+	L.reset ()
+	
+	return response:finish();
+end
+
+return cgilua
diff -pruN 5.2~alpha2-2/src/cgilua/post.lua 6.0.2-2/src/cgilua/post.lua
--- 5.2~alpha2-2/src/cgilua/post.lua	2013-08-09 13:09:14.000000000 +0000
+++ 6.0.2-2/src/cgilua/post.lua	2020-07-04 15:27:37.000000000 +0000
@@ -13,27 +13,21 @@
 --		maxfilesize = 512 * 1024,
 --		args = params,
 --	}
---
--- @release $Id: post.lua,v 1.17 2008/04/03 21:55:28 mascarenhas Exp $
 ----------------------------------------------------------------------------
 
 local iterate = require"cgilua.readuntil".iterate
 local urlcode = require"cgilua.urlcode"
 local tmpfile = require"cgilua".tmpfile
 
-local assert, error, pairs, tonumber, tostring, type = assert, error, pairs, tonumber, tostring, type
-local getn, tinsert = table.getn, table.insert
-local format, gsub, strfind, strlower, strlen = string.format, string.gsub, string.find, string.lower, string.len
-local min = math.min
---local iterate = cgilua.readuntil.iterate
---local urlcode = cgilua.urlcode
---local tmpfile = cgilua.tmpfile
+local assert, error, pairs, tonumber, type = assert, error, pairs, tonumber, type
+local tinsert, tconcat = table.insert, table.concat
+local format, gmatch, strfind, strlower, strlen, strmatch = string.format, string.gmatch, string.find, string.lower, string.len, string.match
+local floor, min = math.floor, math.min
 
 -- environment for processing multipart/form-data input
 local boundary = nil      -- boundary string that separates each 'part' of input
 local maxfilesize = nil   -- maximum size for file upload
 local maxinput = nil      -- maximum size of total POST data
-local inputfile = nil     -- temporary file for inputting form-data
 local bytesleft = nil     -- number of bytes yet to be read
 local content_type = nil  -- request's content-type
 -- local functions
@@ -46,20 +40,24 @@ local read = nil          -- basic read
 -- Extract the boundary string from CONTENT_TYPE metavariable
 --
 local function getboundary ()
-  local _,_,boundary = strfind (content_type, "boundary%=(.-)$")
-  return  "--"..boundary 
+	local boundary = strmatch(content_type, "boundary=(.*)$")
+	if boundary then
+		return "--"..boundary
+	else
+		error("Error processing multipart/form-data.\nMissing boundary")
+	end
 end
 
 --
 -- Create a table containing the headers of a multipart/form-data field
 --
 local function breakheaders (hdrdata)
-  local headers = {}
-  gsub (hdrdata, '([^%c%s:]+):%s+([^\n]+)', function(type,val)
-    type = strlower(type)
-    headers[type] = val
-  end)
-  return headers
+	local headers = {}
+	for name, value in gmatch(hdrdata, '([^%c%s:]+):%s+([^\n]+)') do
+		name = strlower(name)
+		headers[name] = value
+	end
+	return headers
 end
 
 --
@@ -71,11 +69,11 @@ end
 --
 local function readfieldheaders ()
 	local EOH = "\r\n\r\n" -- <CR><LF><CR><LF>
-	local hdrdata = ""
-	local out = function (str) hdrdata = hdrdata..str end
+	local hdrparts = {}
+	local out = function (str) tinsert(hdrparts, str) end
 	if readuntil (EOH, out) then
 		-- parse headers
-		return breakheaders (hdrdata)
+		return breakheaders (tconcat(hdrparts))
 	else
 		-- no header found
 		return nil
@@ -86,28 +84,28 @@ end
 -- Extract a field name (and possible filename) from its disposition header
 --
 local function getfieldnames (headers)
-  local disposition_hdr = headers["content-disposition"]
-  local attrs = {}
-  if disposition_hdr then
-    gsub(disposition_hdr, ';%s*([^%s=]+)="(.-)"', function(attr, val)
-	   attrs[attr] = val
-         end)
-  else
-    error("Error processing multipart/form-data."..
-          "\nMissing content-disposition header")
-  end
-  return attrs.name, attrs.filename
+	local disposition_hdr = headers["content-disposition"]
+	if not disposition_hdr then
+		error("Error processing multipart/form-data."..
+			"\nMissing content-disposition header")
+	end
+
+	local attrs = {}
+	for attr, value in gmatch(disposition_hdr, ';%s*([^%s=]+)="(.-)"') do
+		attrs[attr] = value
+	end
+	return attrs.name, attrs.filename
 end
 
 --
 -- Read the contents of a 'regular' field to a string
 --
 local function readfieldcontents ()
-	local value = ""
+	local parts = {}
 	local boundaryline = "\r\n"..boundary
-	local out = function (str) value = value..str end
+	local out = function (str) tinsert(parts, str) end
 	if readuntil (boundaryline, out) then
-		return value
+		return tconcat(parts)
 	else
 		error("Error processing multipart/form-data.\nUnexpected end of input\n")
 	end
@@ -129,7 +127,7 @@ local function fileupload (filename)
 		local sl = strlen (str)
 		if bytesread + sl > maxfilesize then
 			discardinput (bytesleft)
-			error (format ("Maximum file size (%d kbytes) exceeded while uploading `%s'", maxfilesize / 1024, filename))
+			error (format ("Maximum file size (%d kbytes) exceeded while uploading `%s'", floor(maxfilesize / 1024), filename))
 		end
 		file:write (str)
 		bytesread = bytesread + sl
@@ -174,7 +172,8 @@ end
 -- in its content-disposition header) a temporary file is created 
 -- and the field contents are written to it. In this case,
 -- [[value]] has a table that contains the temporary file handle 
--- (key 'file') and the file name (key 'filename'). Optional headers
+-- (key 'file'), the file name (key 'filename') and size of the file in bytes
+-- (key 'filesize'). Optional headers
 -- included in the field description are also inserted into this table,
 -- as (header_type=value) pairs.
 --
@@ -182,16 +181,7 @@ end
 -- contents.
 --
 local function Main (inputsize, args)
-
-	-- create a temporary file for processing input data
-	local inputf,err = tmpfile()
-	if inputf == nil then
-		discardinput(inputsize)
-		error("Cannot create a temporary file.\n"..err)
-	end
-
 	-- set the environment for processing the multipart/form-data
-	inputfile = inputf
 	bytesleft = inputsize
 	maxfilesize = maxfilesize or inputsize 
 	boundary = getboundary()
@@ -222,10 +212,10 @@ end
 -- Initialize the library by setting the dependent functions:
 --	content_type            = value of "Content-type" header
 --	content_length          = value of "Content-length" header
---	read                    = function that can read POST data
---	discardinput (optional) = function that discard POST data
---	maxinput (optional)     = limit of POST data (in bytes)
---	maxfilesize (optional)  = limit of uploaded file(s) (in bytes)
+--	read                    = function that reads POST data
+--	discardinput (optional) = function that discards POST data
+--	maxinput (optional)     = size limit of POST data (in bytes)
+--	maxfilesize (optional)  = size limit applied to each uploaded file (in bytes)
 --
 local function init (defs)
 	assert (defs.read)
@@ -274,7 +264,7 @@ return {
 			bytesleft = inputsize
 			discardinput(inputsize)
 			error(format("Total size of incoming data (%d KB) exceeds configured maximum (%d KB)",
-				inputsize /1024, maxinput / 1024))
+				floor(inputsize /1024), floor(maxinput / 1024)))
 		end
 
 		-- process the incoming data according to its content type
@@ -286,10 +276,9 @@ return {
 			urlcode.parsequery (read (inputsize), defs.args)
 		elseif strfind(contenttype, "multipart/form-data", 1, true) then
 			Main (inputsize, defs.args)
-		elseif strfind (contenttype, "application/xml", 1, true) or strfind (contenttype, "text/xml", 1, true) or strfind (contenttype, "text/plain", 1, true) then
-			tinsert (defs.args, read (inputsize))
 		else
-			error("Unsupported Media Type: "..contenttype)
+			local input = read(inputsize)
+			tinsert (defs.args, input)
 		end
 	end,
 }
diff -pruN 5.2~alpha2-2/src/cgilua/readuntil.lua 6.0.2-2/src/cgilua/readuntil.lua
--- 5.2~alpha2-2/src/cgilua/readuntil.lua	2013-08-09 13:09:14.000000000 +0000
+++ 6.0.2-2/src/cgilua/readuntil.lua	2020-07-04 15:27:37.000000000 +0000
@@ -20,7 +20,7 @@ return {
 			local dellen = strlen(del) 
 			local i, e
 			while true do
-				i, e = strfind(current, del, 1, 1)
+				i, e = strfind(current, del, 1, true)
 				if i then break end
 				local new = inp()
 				if not new then break end
@@ -28,7 +28,7 @@ return {
 					local endcurrent = strsub(current, -dellen+1)
 					local border = endcurrent .. strsub(new, 1, dellen-1)
 					if strlen(current) < dellen or strlen(new) < dellen or
-						 strfind(border, del, 1, 1) then
+						 strfind(border, del, 1, true) then
 						-- move last part of `current' to new block
 						current = strsub(current, 1, -dellen)
 						new = endcurrent .. new
diff -pruN 5.2~alpha2-2/src/cgilua/session.lua 6.0.2-2/src/cgilua/session.lua
--- 5.2~alpha2-2/src/cgilua/session.lua	2013-08-09 13:09:14.000000000 +0000
+++ 6.0.2-2/src/cgilua/session.lua	2020-07-04 15:27:37.000000000 +0000
@@ -9,7 +9,7 @@ local lfs = require"lfs"
 local serialize = require"cgilua.serialize".serialize
 
 local assert, error, ipairs, loadfile, next, tostring, type = assert, error, ipairs, loadfile, next, tostring, type
-local format, gsub, strfind, strsub = string.format, string.gsub, string.find, string.sub
+local format, gsub, strfind = string.format, string.gsub, string.find
 local tinsert = table.insert
 local _open = io.open
 local remove, time = os.remove, os.time
@@ -225,8 +225,8 @@ end
 -- This function should be called after the script is executed.
 ----------------------------------------------------------------------------
 function M.close ()
-	if next (cgilua.session.data) then
-		M.save (id, cgilua.session.data)
+	if next (M.data) then
+		M.save (id, M.data)
 		id = nil
 	end
 end
diff -pruN 5.2~alpha2-2/src/cgilua/urlcode.lua 6.0.2-2/src/cgilua/urlcode.lua
--- 5.2~alpha2-2/src/cgilua/urlcode.lua	2013-08-09 13:09:14.000000000 +0000
+++ 6.0.2-2/src/cgilua/urlcode.lua	2020-07-04 15:27:37.000000000 +0000
@@ -81,7 +81,7 @@ function M.parsequery (query, args)
 		local insertfield, unescape = M.insertfield, M.unescape
 		gsub (query, "([^&=]+)=([^&=]*)&?",
 			function (key, val)
-				M.insertfield (args, unescape(key), unescape(val))
+				insertfield (args, unescape(key), unescape(val))
 			end)
 	end
 end
diff -pruN 5.2~alpha2-2/src/launchers/cgilua.cgi 6.0.2-2/src/launchers/cgilua.cgi
--- 5.2~alpha2-2/src/launchers/cgilua.cgi	2013-08-09 13:09:14.000000000 +0000
+++ 6.0.2-2/src/launchers/cgilua.cgi	2020-07-04 15:27:37.000000000 +0000
@@ -9,14 +9,16 @@ pcall(require, "luarocks.require")
 local common = require "wsapi.common"
 local cgi = require "wsapi.cgi"
  
-local sapi = require "wsapi.sapi"
- 
+local cgilua = require "cgilua.main"
+
 local arg_filename = (...)
  
-local function sapi_loader(wsapi_env)
+local response = require "wsapi.response"
+local res = response.new()
+
+local function cgi_loader(wsapi_env)
   common.normalize_paths(wsapi_env, arg_filename, "cgilua.cgi")
-  return sapi.run(wsapi_env)
+  return cgilua.main(wsapi_env, res)
 end 
  
-cgi.run(sapi_loader)
- 
\ No newline at end of file
+cgi.run(cgi_loader)
\ No newline at end of file
diff -pruN 5.2~alpha2-2/src/launchers/cgilua.fcgi 6.0.2-2/src/launchers/cgilua.fcgi
--- 5.2~alpha2-2/src/launchers/cgilua.fcgi	2013-08-09 13:09:14.000000000 +0000
+++ 6.0.2-2/src/launchers/cgilua.fcgi	2020-07-04 15:27:37.000000000 +0000
@@ -6,6 +6,7 @@
 
 pcall(require, "luarocks.require")
 
+local fastcgi = require "wsapi.fastcgi"
 local common = require "wsapi.common"
 
 local ok, err = pcall(require, "wsapi.fastcgi")
@@ -30,4 +31,4 @@ local sapi_loader = common.make_isolated
      "PATH_TRANSLATED" } 
 }
 
-wsapi.fastcgi.run(sapi_loader)
+fastcgi.run(sapi_loader)
diff -pruN 5.2~alpha2-2/tests/test_lib.lua 6.0.2-2/tests/test_lib.lua
--- 5.2~alpha2-2/tests/test_lib.lua	2013-08-09 13:09:14.000000000 +0000
+++ 6.0.2-2/tests/test_lib.lua	2020-07-04 15:27:37.000000000 +0000
@@ -1,6 +1,6 @@
 #!/usr/bin/env cgilua.cgi
 local function getfield (t, f)
-  for w in string.gfind(f, "[%w_]+") do
+  for w in string.gmatch(f, "[%w_]+") do
     if not t then return nil end
     t = t[w]
   end
diff -pruN 5.2~alpha2-2/tests/test_main.lua 6.0.2-2/tests/test_main.lua
--- 5.2~alpha2-2/tests/test_main.lua	2013-08-09 13:09:14.000000000 +0000
+++ 6.0.2-2/tests/test_main.lua	2020-07-04 15:27:37.000000000 +0000
@@ -20,7 +20,7 @@ cgilua.serialize (cgilua.POST, cgilua.pu
 cgilua.put "<br>\n"
 cgilua.put ("Remote address: "..cgilua.servervariable"REMOTE_ADDR")
 cgilua.put "<br>\n"
-cgilua.put ("Is persistent = "..tostring (SAPI.Info.ispersistent).."<br>\n")
+--cgilua.put ("Is persistent = "..tostring (SAPI.Info.ispersistent).."<br>\n")
 cgilua.put ("ap="..tostring(ap).."<br>\n")
 cgilua.put ("lfcgi="..tostring(lfcgi).."<br>\n")
 
diff -pruN 5.2~alpha2-2/tests/test_session.lua 6.0.2-2/tests/test_session.lua
--- 5.2~alpha2-2/tests/test_session.lua	2013-08-09 13:09:14.000000000 +0000
+++ 6.0.2-2/tests/test_session.lua	2020-07-04 15:27:37.000000000 +0000
@@ -1,7 +1,7 @@
 #!/usr/bin/env cgilua.cgi
 cgilua.session = require"cgilua.session"
-cgilua.session.setdir"/tmp/"
-cgilua.session.enable ()
+cgilua.session.setsessiondir"/tmp/"
+cgilua.session.enablesession ()
 
 function pt (tab)
 	for i, v in pairs (tab) do
diff -pruN 5.2~alpha2-2/tests/test_variables.lp 6.0.2-2/tests/test_variables.lp
--- 5.2~alpha2-2/tests/test_variables.lp	2013-08-09 13:09:14.000000000 +0000
+++ 6.0.2-2/tests/test_variables.lp	2020-07-04 15:27:37.000000000 +0000
@@ -1,4 +1,5 @@
 #!/usr/bin/env cgilua.cgi
+
 <table>
 <% for _, var in pairs { "SERVER_SOFTWARE", "SERVER_NAME", "GATEWAY_INTERFACE", "SERVER_PROTOCOL", "SERVER_PORT", "REQUEST_METHOD", "PATH_INFO", "PATH_TRANSLATED", "SCRIPT_NAME", "QUERY_STRING", "REMOTE_HOST", "REMOTE_ADDR", "AUTH_TYPE", "REMOTE_USER", "REMOTE_IDENT", "CONTENT_TYPE", "CONTENT_LENGTH", "HTTP_REFERER", "HTTP_COOKIE", "SCRIPT_FILENAME", "DOCUMENT_ROOT", } do %>
   <tr><td><%= var %><td>=<td>"<%= cgilua.servervariable(var) or "<i>not defined</i>"%>"</tr>
