          HTTP & GOPHER SERVERS FOR JNOS1.10m

At last, I did a major cleaning up and extensions to the Gopher and Http
servers for JNOS. Also, I did a lot of stream lining and additions to
the Ftp server.


FTPSERVER:

Some cleaning up and code efficiency. RNFR & RNTO commands
added to rename files (ported from Tnos). APPE command added to append
files. HELP command added. NOOP command fixed.

Unix-like relative interpretation of absolute paths. e.g. if
anonymous has "/pub" as his firstpath then the commands CWD, RETR,
RSME, LIST & NLST would interpret "/yyyy.xxx" as "/pub/yyyy.xxx" if
"/yyyy.xxx" is not permitted.

A new sysop command "ftpmax" added to restrict the number of
concurrent ftp connections.

The ftp permissions work a little differently than standard
JNOS: if a user has any kind of access to a directory, he/she has
also LIST access to that directory.

If Unix-like dir is defined "syst" reports "Unix" and "JNOS" in
banner is replaced with "J*N*O*S" to make WS_FTP to work correctly
in auto detect mode.

Note: There is also a version of ftpserver that uses only binary
transfers. Since, MSDOS's and internet's EOL sequences are the same we
can take advantage of this fact and do all the transfers in binary
mode as long as we have opened the files in binary mode, too. But, you
cannot use LZW compression in this case. The advantage of binary
transfers is that they are much faster. But, if you are using a slow
radio link and a fast computer than the bottle neck is not at the
server instead at the link. In this case, LZW might buy you more speed
than binary. In any case, if you want to have the all binary server
than get the ftpserv.c" from the jnos/www/alt/ dir and replace the one
in www.zip with it.

Note to note: This one doesn't have the WS_FTP mods mentioned above. You have
to do it yourself.

GOPHER:

A lot of bug fixes. Logging to the general log file only. Root
gopher directory can be changed from nos.cfg file with the line
"Gopherdir = /path"; default is "/gopher".  

The URLs can be given as
either "drive:/path" or just "/path". In the latter case, a drive
letter is prepended to the path. The default is "c". You can change 
this with the sysop command "gopher drive <c>", where c is the
drive letter. 

The CSO database file should be called "cso.dbf" and should
reside in the DOS default directory while Jnos is running. 

Now, the big one: You can run as many gopher servers as you 
want, each listening on a different port and using a different root
directory and CSO databasefile without any additional code as in
Ashok's gofer2 server. Just give the command "start gopher <port>".

The root directory for the server listening on port 333 would be
"/g333" and, the CSO file would be "cso333.dbf".

Addition of "gopher maxcli <n>" and, "gopher tdisc <n>" sysop commands. 

"maxcli" sets the number of simultaneous gopher connects 
allowed; the rest gets immediately disconnected, default is 10. 
"tdisc" sets the number of seconds allowed from the connection
till to the request. So that, somebody connot block our gopher server
just by connecting and sitting idle there. Default is 180 secs.
All file transfers are done in binary mode for speed. 


HTTP:

This one is a major rewrite. You can serve any kind of file
accepted by the web browsers. Make sure that those files have proper
extensions, though. 

Default root http directory is also "/gopher". It can be
changed from nos.cfg with "Httpdir = /path".

The URL's can be either like "http://server/drive:/path" or
"http://server/path". In the latter case, again a default drive is
added. You can change this with the command "http drive <c>".

You can start as many http servers as you want each on a
different port. The root directory for the server on port 334 would be

"/g333". This is NOT a typo: port 334 is associated with directory
"/g333". So that you can serv from the same root dir via gopher and
http by listening on consecutive ports. (I hope you wouldn't start an
http server on port 0 :-). 

The file "/gopher/root.htm" is served to the URLs
"http://server/" and "http://server/drive:/". 

This version of http-server is almost a complete implementation
of HTTP/1.0 specification; ie. it uses mime headers. One of the 
headers "Content-Type:" declares the type of the following file. 
The server looks at the extension of the file to determine the value
for this header. If it cannot determine it this way then it looks
if the file is binary, if so, it sends it as type "application/octet-stream"
otherwise it uses the value "text/plain". This means you can't include
the mime-headers in the html files anymore. But, since this feature
allowed for some flexibility I didn't want to give it up. So I left a
door open for that: 	If an URL points to a directory then the file 
"welcome.nhd" in that directory is sent as it is without any headers
if it exists. So, you can use this feature if you need access to the
headers. One reminder though, the URL should point to the directory in
which welcome.nhd resides. An URL like http://server/path/welcome.nhd
would not work as described above. It would be sent as type "text/plain".
If "welcome.nhd" does not exist, "welcome.htm" in
that directory is sent if it exists. Otherwise, a selectable directory
listing in html format is made on the fly. The files "wwwpre.cat" &
"wwwpost.cat" in that directory are pre- and appended to the listing
if they exist. Caution: "wwwpre.cat" is the first half of an html
file, so, it should have all the head elements. On the other hand,
"wwwpost.cat" is the second half the document, so, it must not have
any html head elements in it. 

Addition of "http maxcli <n>", and, "http
tdisc <n>" commands. They do exactly the same thing the "gopher"
commands do for the http server with the same defaults. 

Added some <SERVER> tags to send some run-time determined data.
For any of the following tags to work, your HTML file should have the
following in the very first line:

<SERVER SCAN>

After that you can use the following server control tags in
HTML files. These tags should stand all alone on one line. Nothing else
which is on the same line is sent to the client. Also, use them exactly
as shown. I kept the parsing as simple and fast as possible. So, case
and spacing should be used as shown here:

<SERVER ICOUNT=filename>

If an html file includes this tag, the count of hits kept in
"/WWWSTAT/filename" is incremented and sent to the client. 

   Example:

        This page has been accessed
        <SERVER ICOUNT=thispage.cnt>
        times.

<SERVER COUNT=filename>

    This one does the same thing as "ICOUNT" without incrementing the
    count. It's primary usage is in statistics pages. Where you want to
    report the hits to a page but of course not to increment it at the
    same time.

<SERVER SCOUNT=filename>

    This one is to increment the count kept in the "/WWWSTAT/filename"
    without reporting it to the client.

<SERVER TCOUNT>

    This one reports the total number of accesses to your server. The
    count is kept in the "/wwwstat/tcount.dat". 

<SERVER DATE>

    This one sends the current date and time at the server as a string.

<SERVER UPDATED>

    This one sends the last modification date and time of the HTML file
    in which it is used.

        IMPORTANT: You have to create the "/wwwstat" directory in your
        default http drive for the counters to work. (Default http
        drive is the drive you have set with the "http drive" command.
        If not set, then "C:".)

        Karl-Heinz Weiss pointed out a strange behaviour by Lynx. If
you give an URL like "http://server//" to Lynx, it sends a request for
"//" to the server. In this case, the server sends the directory
listing of the root http dir instead of the root.htm. To fix that, I
suggest putting a file called "welcome.nhd" into the root http dir
with the following contents:

HTTP/1.0 302 Found 

Location: http://yourserver/

<TITLE>Redirection</TITLE>

<H1>Redirection</H1>

You are seeing this page since your web browser does not support
automatic redirection. The file you requested can be found 

<A HREF="http://yourserver/">elsewhere</A>.


HOW TO MAKE:

Get a copy of "jnos110m.zip" from ftp://pc.usl.edu/hamradio/jnos/jnos110m.zip.
Get "www.zip" from ftp.econ.pitt.edu.

First unzip jnos110m.zip, then www.zip onto it. Modify config.h &
makefile then make. 

COMMENTS:

You might want to get the /jnos/www/gopsetup.txt
for instructions to setup the gopher and its search engines. Keep in mind
though, whenever gopsetup.txt and this document conflict, this one is
correct.

I have also added "attribute <file> <H|R|W|S>" to Jnos.
This one sets the DOS file attributes of a file. Eg. 
"atrribute autoexec.nos HSR" would make autoexec.nos hidden, system,
and readonly. "W" corresponds to DOS "normal" attribute and is 
exclusive with the rest. It is handy to hide files for remote sysops
like me. If you don't want it just undef ATTRIB in the config.h.


Bug reports, fixes, comments and requests to

Selcuk Ozturk

seost2+@pitt.edu

Last modified:  Jan 14, 1995
