The http server in Jnos was written by Selcuk Ozturk, N3YCO and Brian Lantz, KO4KS.
This http server is almost completely rewritten from it's first appearance in Jnos 1.10. Selcuk Ozturk took a lot of code and ideas from Brian Lantz' adaptation of this http server in TNOS. An unfortunate effect of this is backwards incompatibility. So, please read this document thoroughly.
Multiple http servers each listening on a different port number, and using a different root path can be run. The maximum number of servers is compile time configurable and is 5 by default. This document will explain the setup of only one. But, it applies to each instance of the server.
HLogsDir = /dir1/dir2
. Every day, a new log
file will be started in this directory. Warning: log files on busy http
servers can grow very large! The naming convention for the log
file is exactly like the general log files. So, you can use
Karl-Heinz Weiss'
cleanlog utility on these files.
start http [port#] [d] [rootdir]
If you omit the bracketed options, the defaults are [port#] == 80; [d] == 'C'; [rootdir] == '/wwwroot'.
http://your.internet.address/c:/dir1/dir2/file.ext
The drive designation in the URL can be dropped, in which case, the drive you have set in the start command will be used. And dir1 is a sub directory of the [rootdir]
/secret TopSecretArea Z3Vlc3Q6aGVsbG8=
into the access.www file created above.
base64 guest:hello
at the DOS prompt. Be careful to exactly copy the output to the access.www file.
<!--# cmdname tag="value" -->
where tag depends on cmdname, and value depends on tag. Here is a list of commands and their associated tags:
DATE_LOCAL
Current local time
DATE_GMT
Current GMT time
HOSTNAME
Hostname of the server
DOCUMENT_URI
Resource Identifier of the current document on
this server
DOCUMENT_NAME
File name of the current document
LAST_MODIFIED
Current document modification time
TOTAL_HITS
Total number of hits to this server
REQ_FROM
The From: header value of request (if given by browser)
REQ_REFERER
The referring URL (if given by browser)
REQ_AGENT
The accessing browser program name (if given by browser)
HttpStatsDir
= /dir1/dir2
.
<!--# echo var="DATE_LOCAL" -->
<!--# echo icount="page1.cnt" -->
<!--# include virtual="file2.htm" -->
<!--# exec cgi="/cgi_function?arguments" -->
This version of the HTTP server has a sort of cgi support. Actually, it is just an interface for further extension of the server code. I thought a lot about how we can support some form and query processing in this server. Any general form processing function I could think of would be too limited. Some kind of scripting language seemed as a possibility, but anything useful and flexible enough would require a lot of memory and would exceed my programming abilities. So, at last, I decided to define a uniform interface and provide a hook for the extension of the server source code. That means, if you know C and the basics of the Jnos code, and a little of the HTTP 1.0 specification, you can write functions for form processing and hook it up with the server source code easily. And since the interface is uniform, these functions can be exchanged between people.
What you have to do is just write a C function which has a certain prototype, and register it in the Cgis[] array in http.c, and that function will be called with all the necessary information passed to it. Then you just have to process the info whichever way you want, and produce an output for the client.
I won't talk about the programming details of this here. I tried to explain how it works in http.c to which you will append your functions. I also included two such functions to demonstrate the way they work: One is a simple x-bitmap graphic hit counter which I have been using for quite a while to supply hit counting service to my friends who have their pages on a server which doesn't allow SSI. The other is a simple form entry logging function which is solely for demonstration purposes. Neither of them are compiled in by default. If you want to see their functioning, you have to turn two '#undef's in http.c to '#define's.
Bug reports, fixes, comments and requests to:
seost2+@pitt.edu
Selcuk Ozturk