Initialize NPDS

OK.. this isn't a script per se but since you can directly execute Newtonscript code in the Script Editor, I am using the Editor to set certain variables within the NPDS environment so that I can test out how my other scripts that depend on things like IP address, Browser version, etc work without having to actually set up an internet connection and connect to a page where these scripts have been inlined. The bottom line is that you can write NPDS CGI applications on the bus or subway in the morning!

What we're doing is filling values to the "Request Frame" that NPDS uses to track all the variables for a given HTTP transaction. Make sure that you do NOT call this script from the HTTP server or the connection will die and probably take NPDS down with it. But otherwise, it's a useful tool.

Name: Initialize NPDS

SSI: XXXX

func(nullvar)

begin

// This isn't a real SSI Script but a debugging // tool. You can set the NPDS Environ however
// you need to test your scripts

//First, warm up NPDS..
//Defines all the static SSI values

|NPDS|:InitializeStaticVars();

//Client address values

local myip:= "127.0.0.1";
local mydns:= "localhost";

//User-agent (Browser) Data

local mybrowser:= "Mozilla/4.5.1 (MSIE 4.5 Macintosh)";

//URL Requested

local mypath:="/html/index.html";

//Stuff our values into the NPDS request frame

|NPDS|.CURRENT_HTTP_REQUEST.ip:= myip;|NPDS|.CURRENT_HTTP_REQUEST.dns:= mydns;|NPDS|.CURRENT_HTTP_REQUEST.agent:= mybrowser;
|NPDS|.CURRENT_HTTP_REQUEST.request:= myPath;

//Press Evaluate and go check out a script that uses one of these values

end