Monday, November 08, 2010 at 12:06 AM.
system.verbs.builtins.webserver.data.trap
on sdoc (pathArgs, kfor="", user="", pass="", frmu="", addr="", svpt="", svnm="", scnm="", meth="", refr="", Kcid="", Kact="", Kapt="", ctyp="", post="", Kcip="", Kfrq="", Agnt="", DIRE="") { <<Thu, Apr 2, 1998 at 6:35:52 PM by WMF <<I did this in 5 minutes <<Once it works we can throw away the commented parts local (paramtable, appID, appName, websiteFolderPath, serverPath); new (tableType, @paramtable); <<The binaryID should be used in send-partial commands <<in place of the appID or appName. The binaryID specifies <<the application that sent the CGI sdoc event <<specifically. This way you can have two copies of WebSTAR <<(for instance) running at the same time. <<Example: <<webstar.sendpartial (myData, adrparams^.connectionID, true, adrparams^.binaryID) <<[Technically: the binaryID is always either a ProcessSerialNumber or a Target ID Record <<('psn ' or 'targ'), but you don't need to know that to use it.] <<local (binaryID = getEventSender ()) <<Get info about the server app. <<bundle <<Get the website folder path. <<if DIRE != "" <<DIRE is the website folder parameter <<websiteFolderPath = DIRE <<else <<websiteFolderPath = webserver.getPref ("websiteFolderPath") << <<Get the server app path and name <<serverPath = webserver.getPref ("serverPath") <<try <<appName = file.fileFromPath (serverPath) << <<Get the server appID <<try <<appID = file.creator (serverPath) <<bundle <<Set up CGI params table <<paramtable.action = Kact <<paramtable.actionPath = Kapt <<paramtable.appID = appID <<paramtable.appName = appName <<paramtable.binaryID = binaryID <<paramtable.clientAddress = addr <<paramtable.clientIP = Kcip <<paramtable.connectionID = Kcid <<paramtable.contentType = ctyp <<paramtable.fromUser = frmu <<paramtable.fullRequest = Kfrq <<paramtable.httpSearchArgs = kfor <<paramtable.method = meth <<paramtable.password = pass <<paramtable.pathArgs = pathArgs <<paramtable.postargs = post <<paramtable.referer = refr <<paramtable.scriptName = scnm <<paramtable.serverName = svnm <<paramtable.serverPath = serverPath <<paramtable.serverPort = svpt <<paramtable.userAgent = Agnt <<paramtable.username = user <<paramtable.websiteFolder = websiteFolderPath <<Parse the post args, if they exist. <<if paramtable.postargs != "" <<new (tabletype, @paramtable.argtable) <<webserver.parseArgs (post, @paramtable.argtable) <<If debugging is on, make a copy of the paramtable. <<if webserver.getPref ("fldebug") <<scratchpad.cgiparams = paramtable bundle { new (tableType, @paramtable.requestHeaders); paramtable.client = addr; paramtable.firstLine = webserver.util.parseHeaders (Kfrq, @paramtable.requestHeaders); paramtable.method = meth; paramtable.path = scnm; paramtable.pathArgs = pathArgs; paramtable.password = pass; paramtable.ready = true; // no idea what this is for paramtable.refcon = 0; // this one either paramtable.request = Kfrq; paramtable.requestBody = post; // hope this works... paramtable.searchArgs = kfor; paramtable.stream = -1; // so that they don't try to use tcp verbs paramtable.username = user}; msg ("about to call dispatch"); return (webserver.dispatch (@paramtable))}
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.