HTTP Server

HTTP Server User Guide



User Guide

1 - System Requirements
2 - Purpose
3 - How To Setup A Server
4 - How To Use The Commandline Interface
5 - HTTP Server At System Startup
6 - How To Use The Favorites
7 - Customizable Error Pages
8 - Configuration File Format Specification
9 - Character Sets
10 - FAQ (Frequently Asked Questions)

1 - System Requirements


2 - Purpose

This HTTP Server is designed to run under 98/NT/2000/XP, you can host a
folder with it and specify the hosting port.

It has features like Directory Browsing and low memory usage during
file transfers. HTTP Server is designed to handle multiple connections.

3 - How To Setup A Server

Step 1:
Execute 'httpsv.exe'.
Step 2:
Step 2 Screenshot
Click the menu 'Server'.
Step 3:
Step 3 Screenshot
Click the menu item 'Select Directory'.
Step 4:
Step 4 Screenshot
Browse for a directory you want to host.
Step 5:
Step 5 Screenshot
If you want viewers to be able to see the files in the directory
select 'Directory Browsing' (optional). This will show the files
in the directory if no 'index.html' or 'index.htm' file is found.
Step 6:
Type in a port number or leave it at 80 (default).
Step 7:
Click the menu 'Server'.
Step 8:
Click the menu item 'Host'.
Step 9:
If everything went fine, the tray-icon will change
color to green, and the status bar will state 'Server running'

You can now minimize HTTP Server, it will stay visible in the tray-icon area. If
you double click the tray-icon, HTTP Server will be set to the foreground again.
If you then again double click the tray-icon, HTTP Server will hide itself.

Right-click the tray-icon of HTTP Server to start, stop, restore or exit the server.

4 - How To Use The Commandline Interface

The commandline interface supports the following commands:

-b [ADDRESS] Limits outside access to the specified address.

(This can be handy when for example you only want a friend to download a file from you but not other leechers.)

A space between the argument and [ADDRESS] is required.
-de Enables Directory Browsing
-p [NUMBER] Specifies the port to use for incoming connections.

The valid port range is 0 - 65536 (i.e. any number between them).

A space between the argument and [NUMBER] is required.
-h [DIRECTORY] Specifies the directory to use as root. If there is a space in the path (like with "C:\Documents and Settings", then you need to insert a quote (" character) before and after the path, but it's not necessary with a path like "C:\WEBROOT", because there is no space in it.

A valid path can be a relative path like 'WEBROOT', which would mean a directory called 'WEBROOT' exists in the directory where 'httpsv.exe' is located.

Or a valid path can be an absolute path like 'C:\WEBROOT'.

If this argument is specified, HTTP Server will automatically start hosting (only if the path specified is valid).

If you want to host the directory where HTTP Server itself is located, you can easily use the -h parameter like this: '-h .\'
The .\ part will make HTTP Server host the relative path .\ which is the directory of 'httpsv.exe' itself.

A space between the argument and [DIRECTORY] is required.
-hide Hides the HTTP Server into the system tray at startup.

Please check the batch files in the 'batch' directory for examples on how to use the commandline interface.

5 - HTTP Server At System Startup

Step 1:
Check the box 'Auto-start at Windows logon'.
Step 1 Screenshot
Step 2:
Enter the desired configuration for HTTP Server.
Step 2 Screenshot
Step 3:
Press 'Finish'.

6 - How To Use The Favorites

Step 1:
Click 'Add Favorite' from the menu 'Favorites'.
Step 1 Screenshot
Step 2:
Enter the desired name as alias for the webroot.
Then enter the full (or relative from directory of 'httpsv.exe')
path to the webroot.

If you do not specify a port, the default HTTP port (80) will
be used.

Turn on the Directory Browsing feature if you want users to be
able to view the contents of the directories if no 'index.htm' or
'index.html' is found.
Step 2 Screenshot
Step 3:
Now you can use the favorite:
Step 4 Screenshot

7 - Customizable Error Pages

You can use customized error pages for the error code range 400-501.
In the root directory where 'httpsv.exe' resides, create a subdirectory
called 'errorpages'. In there put the error page, which should be called:
{ERROR_CODE}.html (for example '404.html')

It is recommended to use inline styles in the error pages.

8 - Configuration File Format Specification

NOTE:
The line endings of the 'httpsv.cfg' file must be in Windows
format, that means one Carriage Return followed by a Line Feed.
In the hexadecimal numbering system, this sequence is known as
0x0D followed by 0x0A
Example File:
Charset=ISO-8859-1

[Favorite1]
Name=fav1
Path=c:\windows

[Favorite2]
Name=fav2
Path=c:\windows\system
Port=22
DirectoryBrowsing=true
BindAddress=10.0.0.2


9 - Character Sets

NOTE:
At the moment there is one known problem with the 'iso-8859-1'
character set and the Directory Browsing feature, please set
the character set to 'GBK' to prevent the layout from cluttering.
 
Character Sets:
iso-8859-1 (standard)
GBK (Chinese)
Shift JIS (Japanese)
EUC-KR (Korean)

Further reference: http://en.wikipedia.org/wiki/Character_encoding

If needed, this list will be expanded later.
Send me an e-mail if you want a character set to be added.

10 - FAQ (Frequently Asked Questions)

CSS Problems


Question:
I'm testing my website on my LOCAL PC (or on a webhost at Internet), and my browser (for example Firefox or Internet Explorer) does not load my CSS stylesheet correctly, what can I do?
Answer:
The Content Type for the '.css' file extension is not correctly set on the server. If you are hosting at a LOCAL PC which you can access the Windows registry of, please run 'files/css_patch.reg' to make sure the Content Type header of a HTTP response will be set to 'text/css'. If you are hosting the website on a host at the Internet, please contact the system administrator of the server.

Using the settings file from CD


Question:
I want to run HTTP Server from a CD, can the 'httpsv.cfg' still be used?
Answer:
Yes and no. The 'httpsv.cfg' file will be read, parsed and used in the favorites menu, but you can't add new favorites when running from a CD or when 'httpsv.cfg' is set to READ-ONLY.

CD Autorun


Question:
I want to automatically run HTTP Server when inserting my CD with 'httpsv.exe' on it, is this possible?
Answer:
Definately. If you have some experience with 'autorun.inf' files on CD's you can create a batch file (or pick one from the 'batch' directory included in the package) and specify the arguments for HTTP Server.

After you have done that, create a file called 'autorun.inf' and put the following information in it:
autorun.inf:
[autorun]
open=run.bat

You also have to edit the example batch file (of your choice) to startup HTTP Server
with the -hide argument. An example 'run.bat':
run.bat:
httpsv.exe -de -h .\web -p 8080 -hide

This will make HTTP Server startup hidden with Directory Browsing enabled, hosting the directory .\web and using port 8080.

Now you have two files called 'autorun.inf' and 'run.bat', put them both in the root directory of the CD.

Router Port Forwarding


Question:
Other users can't view my website, how come?
Answer:
One of the possible causes is that you don't use the default HTTP port 80. Please verify this.

Another possible cause is that your connection is behind a router, if you have access to the router, please verify port 80 is forwarded to the local IP address. Usually you can find this information under a button 'Port Forwarding' or 'Virtual Server' etc.

READ ERROR


Question:
I see a 'READ ERROR' message in my log, what is this?
Answer:
A file requested by the client was probably in use or locked, or the computer was low on memory at the time of the request. You should both check whether this happens often and check if the computer is low on memory.