AOLserver 2.1 ADP Module


Based on the ADP code in AOLserver 3.0b3, this AOLserver module allows for users of AOLserver 2.1 to run ADPs. We work around the "page scope" variables ns_share/global problem by using our ASP-style ADP parser. Just like AOLserver 3, it supports caching (adds all Tcl caching commands such as ns_cache_stats), streaming, "page scope" variables, and registered ADP parsers.

Installation is fairly simple. You will need to either download the source and compile the module, or download the pre-compiled Win32 binary module . These instructions will assume that have downloaded (or already compiled) the module. For obvious reasons these instructions assume you're using NT. The first step is to copy the module (adp.dll) into your AOLserver\bin directory. Next modify your nsd.ini to set the module to run at startup. To do this add to your ns/server/vserver/modules the line:


Now add the desired ADP configuration parameters to ns/server/vserver/adp. For information on the possible parameters see the AOLserver 3 Administrator's Guide. We support all the same parameters the only difference is that the default parser is aspStyle instead of adp. Here's an example configuration:


Next restart your AOLserver, check your Server Log for errors, and verify that the configured virtual server is serving ADPs correctly. If you downloaded the pre-compiled module it includes test.adp which you can use to test the module (you'll have to copy it to your pageroot).

Differences from AOLserver 3.0

The main visible difference is the parsers. As mentioned above the default parser is the ASP-style parser which doesn't require ns_shares (which don't exist in 2.1) to support "page scope" variables. We've included the adp (default for AOLserver 3) and fancy parser and they both work fine, except they don't support "page scope" variables; which you may/may not need. We soon hope to have a fancy ASP-style parser.


Implementation was rather simple: we FTPed the necessary files from one of our Linux boxes to an NT station, brought the files into Visual Studio, made the necessary modification to make everything work as a module (in AOLserver 3 it's compiled into nsd), and made modifications to make everything work in AOLserver 2.1 (along with cursing K&R for not putting strcasecmp in the standard library).

The biggest implementation change is how we call the ADP engine from a URL (i.e. not from the ns_adp_parse or ns_adp_include Tcl commands). In AS3 the ADP engine is registered to the specified map configuration parameters by Ns_RegisterRequest to AdpProc. AdpProc then calls the same code that ns_adp_parse or ns_adp_include would call passing it a Tcl interpreter. We couldn't actually do this in 2.1 because we couldn't allocate a Tcl interpreter from a function called through a Ns_RegisterRequest. To work around this we made AdpProc a Tcl command (_ns_adp_processed) that we registered through ns_register_proc. Since on the C side Tcl commands have access to an interpreter (this is one of their parameters) the workaround works pretty good but may result in some loss of performance compared to AOLserver 3. Although this is probably insignificant.

Other implementation changes: we modified the fancy parser to lock the tags database by doing mutexs instead of read/write locks (read/write locks don't exist in 2.1; I realize I could probably easily implement them and I may do so in a later release), and cutting out all functions in the cache code which relied on Ns_Cond* (I also realized I could easily emulate Ns_Cond* behavior but since none of the ADP code used those caching functions it wasn't worth the time).


getHTTP | ASP-Style ADP Parser | ADPs for AOLserver 2.1

© Copyright 1996-2014 by and Solitex Networks. Legal Notices.
Creative Commons License Articles on this site are licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.