Small HTTP server
How to...?
-- Very easy -- unpask, with store patch, run srv.exe
and that's all ! If your browser hsn't Internet witch proxy,
then even not entring into the network, you can go to your
cite useing standarts IP-entry http://127.0.0.1/.
If you haven't your own DNS-name, it is not a problem. Any user
can go to your cite with the help of your IP. Indicate (pointout) it,
when you registrate on searching service.
Directoryes and files names.
Server suporte definite names of directoryes.
Your cite begin with subdir WWW. WWW -- it's root of cite
Files can transfer only from this dir or from any its subdir
, except WWW/CGI-BIN/ . Assume, that
WWW/CGI-BIN/ have executable CGI-scrips. When receive requist
to file from WWW/CGI-BIN/ server attempt to run it.
With it, if file have extencion *.pl then run Perl.exe, that
must by in the PATH, or into some dir as server.
For example, if you extract programm into C:\HTTP then
with your IP accessible files from C:\HTTP\WWW and
http://127.0.0.1/test.htm==C:\HTTP\WWW\test.htm. In this
case CGI can run from C:\HTTP\WWW\CGI-BIN\
If You make sub dir WWW\IMAGES into WWW and save there
file bgr.gif then you can get it with http://127.0.0.1/images/bgr.gif.
It means, that remote user must use your realy IP or DNS
entry.
Always, when requist haven't filename i.e.
ends in a '/' then server subscrible index.htm with witch have been requisted
patch. Example http://127.0.0.1/My/ as equal
http://127.0.0.1/My/index.htm
Server detected type of
file witch extencion. Suported next types:
*.htm,*.html - text/html
*.txt - text/plain
*.gif - image/gif
*.jpg,jpeg - image/jpeg
In any other case server responce */* with that,
clients browser as rule prompt to store file on the disk,
or to run it with some other application.
Run scripts.
As I pointed before, scripts can run from subdir WWW/CGI-BIN/
With the suporte of interface CGI/1.0. Detail description of it you
can find for example in
http://Web.Golux.Com/coar/cgi/
Runing requist line transfer witch command and into
enviroment variable QUERY_STRING. After runing standart out count
(stdout in C) direct send to remote user. At first script, must
return the end of http header that owe have line
"Content-Type: type\r\n". Also some other service
lines can presented, for example Content-Length: xx\r\n or Date: At the end of
service header must sequence "\r\n\r\n" be . If you write
into C or Perl then, hight level output functions, in text
mode replase symbol '\n' to sequence '\r\n' its self.
In the Pascal function "writeln" complete output with this sequence.