--- SphooWEB HTTPd/1.0 ---

--- Sphoo Inc. ---
--- stu.mcneill@net.ntl.com - http://www.mcneill.dircon.co.uk/sweb/ ---


--- Introduction (just skip it, you know you want to) ---

SphooWEB HTTPd/1.0 is a web server for mIRC.  Don't ask why I made it, I
just did one day.  There really is no point to it being in mIRC,
except I don't know any other programming languages heh.

So what can it do I hear you cry?  Well, not only will it take your usual
GET and HEAD requests, it handles codes 302, 304, 404, and 503 (Redirection,
Not Modified, Not Found, and Too Many Connections respectively).  It can also
create directory listings.

It also handles files/directories with spaces in, and makes sure people can't
access other paths on your computer using the simple /../ trick (SphooWEB
just redirects them to the root path).

Remember this is just a tiny script, I'll probably work on it again, it was a
creation made by boredom.

NOTE ABOUT DIRECTORY LISTING: Creating the html pages containing the directory
listings are done on demand when requested, and take up system resources.  i
found that on directories containing 100+ files mIRC started to freeze for a
second.  Sorry 'bout that, but I really don't care :P


--- Installing ---

Simple... Just put all the SphooWEB files somewhere (preferably your
mIRC directory) and then in mIRC type the following command - 

/load -rs directory-with-the-files\sweb10.mrc

Then when it asks if you want to run the initialization commands answer
YES.


--- Using ---

To start the server, just click on the "Start SphooWEB HTTPd" command
in any popup menu (the menu that appears whenever you right-click in a
window).  You can also start the server by typing "/sphooweb" in any
mIRC window.

From the moment the SphooWEB console window opens the server is running.


--- Configuring ---

To configure SphooWEB's settings, click the Configure.. button in the
main SphooWEB window.  The items to configure are as follows -

Server Root - The directory where the files you want to be available on
the web server are.  You can either manually type in a directory or press
the Browse... button to bring up a browsing dialog.

Default Index - The file to load in a directory if no file is specified.
You can specify more than one file to look for, seperated by spaces.  The
server looks in the order specified.  NOTE: The most common index files
(index.html and index.htm) are set as default, you cannot specify filenames
with spaces.

Admin Email - Your email address.  This is used when error pages are sent to
users as a contact.  If you don't want to give out your email address just
make it up or something.

Default MIME Type - If you don't know about MIME types, don't touch this.
Otherwise, this setting is to specify what the server should give a file if
it doesn't have its own MIME type entry (you can add new MIME types, described
later).

Max. Connections - The number of simultanious connections allowed to your
server.  This is useful if you have very limited bandwidth and files are big.

Port - The port you want to run the server on.  The default http port is 80,
so only change this if you need to.

Load Server Console On mIRC Startup - Loads SphooWEB as mIRC loads if checked.

Always Ontop - Makes SphooWEB on top of all other applications.

If No Index File Is Found... - Options are either Show Directory Listing, which
will send the user a html page listing all the files in that directory, or
Show File Not Found, which will send the user an error 404 page instead.


--- MIME Types ---

You can add/remove MIME types as and when you want, but be careful, if you have
the wrong MIME type with a file it will mess up how the user's web browser trys
to view the file.

To edit the MIME Types list press the MIME Types... button in the SphooWEB
Setup window.  All the controls for adding/removing are accessed by right
clicking in the MIME Types window.

NOTE: A file called swebmime.default is supplied which is a copy of the MIME
type list incase you delete a few more types than you intended.


--- Redirection (http code 302) ---

Say you want to send someone to another web page somewhere, you can do this by
simply fooling the user with an "alias" path on your server.

To add/remove redirection entries click on the Redirection... button in the
SphooWEB Setup window and right-click in the window to control everything.

An example of redirection is as follows.

- First create an alias path on your server called /blah/
- Then set a real url for that path called http://www.an-example.com
- Now if a user tries to access that path on your server they will
  automatically be taken to http://www.an-example.com


--- Aliases ---

Aliases are a lot like redirection entries, except the real url is a path
somewhere on your computer, and the user still thinks its called whatever you
want it to be called.

- First you create the alias path, something like /alias/
- You'll then asked for the real path, and given a chance to browse your
  computer to find the correct path.
- Now when a user accesses that path, it will still seem to them like its the
  real path, even though its somewhere completely different.

NOTE ABOUT REDIRECTION AND ALIASES: I haven't made any way to stop you adding
redirection or alias paths that already exist.  The order in which SphooWEB
checks paths are real paths, then aliases, then redirection.

--- Unloading ---

Even though I'm sure you'll never want to get rid of SphooWEB, to unload it
type the following command in mIRC -

/unload -rs sweb10.mrc
