www.pudn.com > www_toolkit.zip > w3mfc.htm, change:1999-06-29,size:11353b


<html> 
 
<head> 
<title>W3Mfc v1.1</title> 
</head> 
 
<body bgcolor="#FFFFFF"> 
 
<p align="left"><img src="w3mfc.gif" width="39" height="35" alt="w3mfc.gif (1165 bytes)"><font 
face="Arial"><big><big><big><big><strong>W3Mfc v1.1</strong></big></big></big></big></font></p> 
 
<p><font face="Arial">Welcome to <strong>W3Mfc</strong>, a collection of freeware MFC 
classes to implement a simple Web server.</font></p> 
 
<p><font face="Arial">The idea behind is W3Mfc was originally to learn about the Http 
protocol and how it is implemented on Win32. It is not intended to be a replacement for 
IIS or Apache. Instead it is designed as a tool for learning or in cases where deployment 
of a solution on IIS would be considered overkill or your product must run on 95/98 in 
addition to NT.</font></p> 
 
<p><font face="Arial">For detailed information about the <strong>H</strong>yper <strong>T</strong>ext 
<strong>T</strong>ransfer <strong>P</strong>rotocol you should read RFC 1945, You can 
download this from a number of sites by searching for RFC and 1945 on <a 
href="http://www.yahoo.com">www.yahoo.com</a>.</font></p> 
 
<p><font face="Arial">Another document that these classes refer to is RFC 2045 which 
defines MIME.</font></p> 
 
<p> </p> 
 
<p><font face="Arial">The classes which constitute W3Mfc are:</font></p> 
 
<p><font face="Arial"><em>CHttpServerSettings</em>: This class contains the settings which 
are used to configure the web server. Example member variables in this class include the 
virtual directories and the their default filenames. If you are developing a stand alone 
web server based on W3Mfc, you could for example store all the variables for the 
CHttpServerSettings instance in an ini file or in the registry.</font></p> 
 
<p> </p> 
 
<p><font face="Arial"><em>CHttpServer</em>: This is the actual class which implements the 
web server. It has a number of very simple functions to allow you to control the state of 
the web server such as Start and Stop. Internally a background thread is spun off to 
handle the client connections.</font></p> 
 
<p> </p> 
 
<p><font face="Arial"><em>CHttpSocket</em>: This is a simple C++/MFC encapsulation of an 
SDK socket.</font></p> 
 
<p> </p> 
 
<p><font face="Arial"><em>CHttpResponseHeader</em>: This class helps in the handling of 
sending request headers when returning the HTTP responses to clients. It provides a number 
of methods to allow standard Http headers to be added to the client response.</font></p> 
 
<p> </p> 
 
<p><font face="Arial"><em>CHttpMimeManager</em>: This class is used when returning client 
responses. It is used to determine to mime type of a file given its extension type. This 
information is taken from the registry and is cached in this class. For example files of 
.htm or .html will normally be of mime type "text/html".</font></p> 
 
<p> </p> 
 
<p><font face="Arial"><em>CHttpRequest</em>: This class represents a request from a 
client. It contains information such as the URI of the request, the Http Verb used and the 
Http version used for the request. A member of this type is stored in the CHttpClient 
class.</font></p> 
 
<p> </p> 
 
<p><font face="Arial"><em>CHttpClient</em>: This class is used in the CHttpServer class to 
handle client connections. It handles the parsing of client requests and returning the 
appropriate response. A number of virtual functions are provided to allow end user 
customisation.</font></p> 
 
<p> </p> 
 
<p> </p> 
 
<p> </p> 
 
<table> 
  <tr> 
    <td><font face="Arial"><a href="#Features">Features</a></font></td> 
  </tr> 
  <tr> 
    <td><font face="Arial"><a href="#Usage">Usage</a></font></td> 
  </tr> 
  <tr> 
    <td><font face="Arial"><a href="#History">History</a></font></td> 
  </tr> 
  <tr> 
    <td><a href="#To Do"><font face="Arial">To Do</font></a></td> 
  </tr> 
  <tr> 
    <td><font face="Arial"><a href="#Contact">Contacting the Author</a></font></td> 
  </tr> 
</table> 
 
<p> </p> 
 
<p> </p> 
 
<p> </p> 
 
<p><font face="Arial"><a name="Features"></a><big><strong><big>Features</big></strong></big> 
</font> 
 
<ul> 
  <li><font color="#000000" size="3" face="Arial">HTTP/1.0 compliant</font></li> 
  <li><font color="#000000" size="3" face="Arial">Uses the Windows registry to determine mime 
    type thus simplifying configuration.</font></li> 
  <li><font color="#000000" size="3" face="Arial">Supports passthrough plaintext 
    authentication for files located on NTFS volumes.</font></li> 
  <li><font color="#000000" size="3" face="Arial">Supports running under a configurable user 
    account.</font></li> 
  <li><font color="#000000" size="3" face="Arial">Supports binding to a specific IP address.</font></li> 
  <li><font color="#000000" size="3" face="Arial">Supports multiple virtual directories.</font></li> 
  <li><font color="#000000" size="3" face="Arial">Supports directory listing.</font></li> 
  <li><font color="#000000" size="3" face="Arial">Server name returned can be easily 
    configured.</font></li> 
  <li><font color="#000000" size="3" face="Arial">Supports server redirection by means of the 
    HTTP 301 status code.</font></li> 
  <li><font color="#000000" size="3" face="Arial">Consumes very little system memory and CPU 
    resources</font></li> 
  <li><font color="#000000" size="3" face="Arial">Compact and easy to follow implementation.</font></li> 
  <li><font color="#000000" size="3" face="Arial">The interface provided is synchronous which 
    provides an easier programming model than using asynchronous sockets.</font></li> 
  <li><font color="#000000" size="3" face="Arial">The code does not rely on the MFC socket 
    classes. These classes have a number of shortcomings, one of which causes problems when 
    they are used in NT services.</font></li> 
  <li><font color="#000000" size="3" face="Arial">The code can be used in a console 
    application without any problems.</font></li> 
  <li><font color="#000000" size="3" face="Arial">The classes are fully Unicode compliant and 
    include Unicode built options in the workspace file.</font></li> 
</ul> 
 
<p> </p> 
 
<p> </p> 
 
<p> </p> 
 
<p><a name="Usage"></a><font face="Arial"><big><big><strong>Usage</strong></big></big></font> 
 
<ul> 
  <li><font color="#000000" size="3" face="Arial">To use the class in your code the following 
    modules in your project:<br> 
    base64.cpp/h<br> 
    HttpClient.cpp/h<br> 
    HttpMimeManager.cpp/h<br> 
    HttpResponseHeader.cpp/h<br> 
    HttpSocket.cpp/h<br> 
    W3Mfc.cpp/h<br> 
    You will also need to copy over all the resources from the w3mfc.rc file into your 
    resource file.</font></li> 
  <li><font face="Arial">Your code will need to include MFC either statically or dynamically.</font></li> 
  <li><font face="Arial">You will need to have a functioning winsock stack installed and 
    correctly initialised prior to starting the web server. Depending on your application, 
    this will involve calling either WSAStartup or AfxSocketInit at startup of your 
    application.</font></li> 
  <li><font face="Arial">You will also need to have afxtempl.h ,winsock.h or afxsock.h and 
    afxpriv.h in your precompiled header. The code will work just aswell in a GUI or console 
    app. The code should also work in a multithreaded application, although it has not be 
    explicitly tested in this scenario.</font></li> 
  <li><font face="Arial">To see the class in action, have a look at the code in InitInstance 
    in the module "main.cpp" on how to start up and stop the server.</font></li> 
</ul> 
 
<p> </p> 
 
<p> </p> 
 
<p> </p> 
 
<p><font face="Arial"><big><a name="History"></a></big><font color="#000000" size="5"><strong>History</strong></font></font></p> 
 
<p><strong><font color="#000000" size="3" face="Arial">V1.0 (4th M</font><font 
face="Arial"><font size="3"><font color="#000000">ay</font></font><font color="#000000" 
size="3"> 199</font></font><font color="#000000" size="3" face="Arial">9)</font></strong>  
 
<ul> 
  <li><font color="#000000" size="3" face="Arial">Initial public release.</font></li> 
</ul> 
 
<p><font color="#000000" size="3" face="Arial"><strong>V1.1 (29th June 1999)</strong></font> 
 
<ul> 
  <li><font face="Arial">Implemented support for "HEAD" command</font></li> 
  <li><font face="Arial">Sample provided now also displays the HTTP verb used</font></li> 
  <li><font face="Arial">Sample provided now also displays the date and time of each request</font></li> 
  <li><font face="Arial">Now fully supports multiple virtual directories</font></li> 
  <li><font face="Arial">Now fully supports URL's with encoded characters</font></li> 
  <li><font face="Arial">Implemented support for "DELETE" command</font></li> 
  <li><font face="Arial">Now returns an "Allow:" HTTP header</font></li> 
  <li><font face="Arial">Timeout for requests is now 90 seconds if built for debug</font></li> 
  <li><font face="Arial">Now supports directory listing</font></li> 
  <li><font face="Arial">User name is now displayed in the log window</font></li> 
</ul> 
 
<p> </p> 
 
<p> </p> 
 
<p><a name="To Do"></a><font face="Arial" color="#000000" size="4"><strong>To Do</strong></font><font 
face="Arial"> </font></p> 
 
<p><em><font face="Arial">GENERAL</font></em>  
 
<ul> 
  <li><font face="Arial">Support for CGI</font></li> 
  <li><font face="Arial">Support for ISAPI</font></li> 
  <li><font face="Arial">Support for NSAPI</font></li> 
  <li><font face="Arial">HTTP/1.1 support</font></li> 
  <li><font face="Arial">TransmitFile support</font></li> 
  <li><font face="Arial">Integrated search tool</font></li> 
  <li><font face="Arial">Support for NCSA and Apache Server Side Includes (SSI)</font></li> 
  <li><font face="Arial">Multithreading / thread pool support to improve performance.</font></li> 
</ul> 
 
<p><em><font face="Arial">SECURITY</font></em>  
 
<ul> 
  <li><font face="Arial">Support for SSL</font></li> 
  <li><font face="Arial">NT authentication</font></li> 
  <li><font face="Arial">PCT support</font></li> 
  <li><font face="Arial">Integrated Certificate manager</font></li> 
</ul> 
 
<p><em><font face="Arial">LOGGING</font></em>  
 
<ul> 
  <li><font face="Arial">Support Apache compatible common logfile format log files</font></li> 
  <li><font face="Arial">W3C extended log format</font></li> 
  <li><font face="Arial">log to ODBC database</font></li> 
  <li><font face="Arial">Daily log files</font></li> 
  <li><font face="Arial">log file cycling</font></li> 
  <li><font face="Arial">log file archiving</font></li> 
  <li><font face="Arial">customizable log file formats</font></li> 
  <li><font face="Arial">Real-time performance counters</font></li> 
  <li><font face="Arial">NT Event Log logging<font color="#000000" size="3">.</font></font></li> 
</ul> 
 
<p> </p> 
 
<p> </p> 
 
<p> </p> 
 
<p><font face="Arial"><a name="Contact"></a><font color="#000000" size="4"><strong>CONTACTING 
THE AUTHOR</strong></font></font></p> 
 
<p><font color="#000000" size="3" face="Arial">PJ Naughter<br> 
Email: <a href="mailto:pjn@indigo..ie">pjn@indigo.ie</a><br> 
Web: <a href="http://indigo.ie/~pjn">http://indigo.ie/~pjn</a><br> 
29th June 1999</font></p> 
</body> 
</html>