summaryrefslogtreecommitdiffstats
path: root/debian/perl-framework/t/htdocs/modules/lua
diff options
context:
space:
mode:
Diffstat (limited to 'debian/perl-framework/t/htdocs/modules/lua')
-rw-r--r--debian/perl-framework/t/htdocs/modules/lua/201.lua3
-rw-r--r--debian/perl-framework/t/htdocs/modules/lua/hello.lua4
-rw-r--r--debian/perl-framework/t/htdocs/modules/lua/hello2.lua4
-rw-r--r--debian/perl-framework/t/htdocs/modules/lua/https.lua7
-rw-r--r--debian/perl-framework/t/htdocs/modules/lua/method.lua3
-rw-r--r--debian/perl-framework/t/htdocs/modules/lua/setheaderfromparam.lua10
-rw-r--r--debian/perl-framework/t/htdocs/modules/lua/setheaders.lua4
-rw-r--r--debian/perl-framework/t/htdocs/modules/lua/translate.lua28
-rw-r--r--debian/perl-framework/t/htdocs/modules/lua/version.lua3
9 files changed, 66 insertions, 0 deletions
diff --git a/debian/perl-framework/t/htdocs/modules/lua/201.lua b/debian/perl-framework/t/htdocs/modules/lua/201.lua
new file mode 100644
index 0000000..f354125
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/lua/201.lua
@@ -0,0 +1,3 @@
+function handle(r)
+ r.status = 201
+end
diff --git a/debian/perl-framework/t/htdocs/modules/lua/hello.lua b/debian/perl-framework/t/htdocs/modules/lua/hello.lua
new file mode 100644
index 0000000..85cd99e
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/lua/hello.lua
@@ -0,0 +1,4 @@
+function handle(r)
+ r.content_type = "text/plain"
+ r:puts("Hello Lua World!\n")
+end
diff --git a/debian/perl-framework/t/htdocs/modules/lua/hello2.lua b/debian/perl-framework/t/htdocs/modules/lua/hello2.lua
new file mode 100644
index 0000000..2a4b16f
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/lua/hello2.lua
@@ -0,0 +1,4 @@
+function handle(r)
+ r.content_type = "text/plain"
+ r:puts("other lua handler\n")
+end
diff --git a/debian/perl-framework/t/htdocs/modules/lua/https.lua b/debian/perl-framework/t/htdocs/modules/lua/https.lua
new file mode 100644
index 0000000..9393093
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/lua/https.lua
@@ -0,0 +1,7 @@
+function handle(r)
+ if r.is_https then
+ r:puts("yep")
+ else
+ r:puts("nope")
+ end
+end
diff --git a/debian/perl-framework/t/htdocs/modules/lua/method.lua b/debian/perl-framework/t/htdocs/modules/lua/method.lua
new file mode 100644
index 0000000..e5ea3ee
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/lua/method.lua
@@ -0,0 +1,3 @@
+function handle(r)
+ r:puts(r.method)
+end
diff --git a/debian/perl-framework/t/htdocs/modules/lua/setheaderfromparam.lua b/debian/perl-framework/t/htdocs/modules/lua/setheaderfromparam.lua
new file mode 100644
index 0000000..6c8d9c5
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/lua/setheaderfromparam.lua
@@ -0,0 +1,10 @@
+-- Syntax: setheader.lua?HeaderName=foo&HeaderValue=bar
+--
+-- This will return a document with 'bar' set in the header 'foo'
+
+function handle(r)
+ local GET, GETMULTI = r:parseargs()
+
+ r.headers_out[GET['HeaderName']] = GET['HeaderValue']
+ r:puts("Header set")
+end
diff --git a/debian/perl-framework/t/htdocs/modules/lua/setheaders.lua b/debian/perl-framework/t/htdocs/modules/lua/setheaders.lua
new file mode 100644
index 0000000..faa7f68
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/lua/setheaders.lua
@@ -0,0 +1,4 @@
+function handle(r)
+ r.headers_out["X-Header"] = "yes"
+ r.headers_out["X-Host"] = r.headers_in["Host"]
+end
diff --git a/debian/perl-framework/t/htdocs/modules/lua/translate.lua b/debian/perl-framework/t/htdocs/modules/lua/translate.lua
new file mode 100644
index 0000000..7d19c9a
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/lua/translate.lua
@@ -0,0 +1,28 @@
+require 'apache2'
+
+function translate_name(r)
+ r:debug("translate_name: " .. r.uri)
+ local query = r:parseargs()
+ if query.translateme then
+ r:debug("translate_name: translateme was true " .. r.uri)
+ r.uri = "/modules/lua/hello.lua"
+ return apache2.DECLINED
+ end
+ return apache2.DECLINED
+end
+
+function translate_name2(r)
+ r:debug("translate_name2: " .. r.uri)
+ local query = r:parseargs()
+ if (query.ok) then
+ r:debug("will return OK")
+ end
+ if query.translateme then
+ r.uri = "/modules/lua/hello2.lua"
+ if query.ok then
+ r.filename= r.document_root .. r.uri
+ return apache2.OK
+ end
+ end
+ return apache2.DECLINED
+end
diff --git a/debian/perl-framework/t/htdocs/modules/lua/version.lua b/debian/perl-framework/t/htdocs/modules/lua/version.lua
new file mode 100644
index 0000000..7853844
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/lua/version.lua
@@ -0,0 +1,3 @@
+function handle(r)
+ r:puts(apache2.version)
+end