you've been aksing for the "config.pages[request.path]" -List.
This is how it is comming to live:
First you have to create the List containing the functions handling the Page-Requests sent to the Web server:
pages = {}
pages["/led.gif"] = function(request)
file.open("led.gif")
X = file.read()
file.close()
tmr.wdclr()
return X , "image/gif"
end
....
Now you load the Servers code :
dofile("httpServer.lua")
This defines a Function "startWeb()" with the Argument "cfg"
When invoking the Server you have to pass this List as an Argument.
w = startWeb({pages = pages})
This is how your pages-List becomes a Item of the List "cfg" passed as Parameter to startWeb()
(The Example is somewhat irritating by using the same name "pages" for the global List created by the user and the local copy used in the body of startWeb()-Function)
The part of the Webserver-script creates a local copy of the cfg-list named "config":
...
function startWeb(cfg)
-- define member variables
local config = cfg
...
Now the Server-script knows a List named "config" containing a item "pages" (which was passed as parameter to the function "startWeb(cfg)". This pages-item is an other list containing the Callback-functions handling the page-requests.
So config.pages[request.path] points to a function (hopefully) defined by you as a item af the pages-list to handle the request to "path" comming from the web- client.
The "request.path" is extracted from the Browsers Request by the Weberserver-script doing some (not so easy to understand) regexp-magic. (Discussing this would lead too far here).
Remember that all above Examples show only relevant parts of the code you'll need.
Some fine day i will clean up my code and publish an complete example for a working Server with pages containing images and cgi-funtions (read GPIO, read ADC, set PWM-Value, "beep"), so stay tuned..