How to use WTDP
This is a fast introduction in WTDP.
We hope to develop a better description of the WTDP soon.
How works is the WTD-Protocol?
I'll try to answer the question about WTDP by describing what happens when
the server gets a WTDP request:
If the server gets a WTDP request (in my case for example:
'HTTP://130.89.224.16/openwin.wtd'), it will first look up the openwin.wtd
file in the WTDP directory (specified in w4-serve.ini). For openwin, this
file is:
[WTD]
ExecFile openwin.exe
OutPutFile \docs\html\wtd\openwin.htm
HTMLFile \html\wtd\openwin.htm
[end]
The ExecFile (here openwin.exe) is the file that W4-Server will execute, in
response to this WTD request.
This executable has to be in the WTD directory too !
The second line specifies the file that the WTDP application is to change/create
The last line (HTMLFile) specifies the HTMLFile that W4-Server will return
to the client.
Armed with this information, the next thing the server will do is to create
a temp file in the Windows directory (so that the wdt application can always
find it) called 'w4-serve.tmp' which contains all the information a wtd
application might need.
The different 'entries' in this file are separated by 'TABS' (character 09),
these entries are:
- The W4-Server directory (e.q. C:\W4-SERVE)
- The output file (as mentioned above, the file that the application is to
change) this outputfile is specified 'from the Server directory', that is:
the server directory (1st entry) is considered 'the root directory'
- The IP-Address of the client that made the request (4 bytes)
If the WTDP-request was the result of a 'POST' action, this entry
contains all the information returned by Netscape, separated by &
characters, otherwise this entry is 'blanc' (literally !, so the text in
this entry is 'blanc').
- The return file, the file that the Server will send back to the client
after the WTDP-application has finished
This time, the 'DOCS' directory is considered 'the root' !
If the WTDP-applications wants the server to return a different file to
the client than this one, the WTDP-appl. is allowed to change this entry,
otherwise it is advised to delete the temp file after all the parameters
have been extracted.
...... With the new WTDP protocol, it is possible to send extra parameters
with the request, this might be helpfull if you want to be able to 'keep
track' of the clients that use this WTDP-application, or if you want the
application to react in different ways, depending on the last request of a
client. An example of an application that uses parameters is 'FTP.WTD'
(http://130.89.232.242/ftp.wtd). This is a FTP/GOPHER look-a-like
application that uses the extra parameters to jump from directory to directory.
The extra parameters are stored as separate entries (6 and further).
Remember that, because (the number of) extra parameters are optional, the
temp file has a variable amount of entries !
The way you can pass extra parameters is (for example in a 'HREF') to place
them behind the '*.wtd' in the HREF, separated with | characters. for example:
<a href="/ftp.wtd go|c:\w4-serve\docs"><img border=0 src="/pics/dir.gif">
docs/</a>
where the extra parameters are 'go' and 'c:\w4-serve\docs'
In the temp file however, the parameters are separated by TABS !
After the WTDP-application is finished, W4-Server will return the file
specified in the temp file. (Or the .wtd file if you've erased the temp file.)
We hope that this answers your questions.
If you have any further questions or if things aren't quite clear yet,
please let us know. We'll be glad to help you !
Good luck with your WTDP application, We would like to see the result when
it's finished !
Greetings,
Antelope Software