equal
deleted
inserted
replaced
|
1 |
|
2 -- examine the request. |
|
3 -- this emits to stderr! |
|
4 -- |
|
5 for k,v in pairs( request ) do print( string.format("request.%-6s --> %s", k, v) ) end |
|
6 |
|
7 -- all variables need to be declared using local scoping! |
|
8 -- |
|
9 local redir = 302 |
|
10 |
|
11 -- temporary redirect to a different site, every other second. |
|
12 -- why would you want to do this? you probably wouldn't. just illustrating |
|
13 -- how easy it is to do custom stuff. |
|
14 -- |
|
15 if os.time() % 2 == 0 then |
|
16 return string.format( "%d:http://example.com%s", redir, request.path ) |
|
17 end |
|
18 |