CHttpServer

CHttpServer does not have a base class.

The class CHttpServer, with CHttpServerContext, provides a means to extend the functionality of an ISAPI-compliant HTTP server. The class CHttpServer wraps the Internet Server API (ISAPI) functionality and can process various types of client requests, including extension DLLs. CHttpServer cannot process client requests from Common Gateway Interface (CGI) executables. These extension DLLs are sometimes called Internet Server Applications; however, they are DLLs, rather than EXEs. For brevity’s sake, we refer to an extension DLL as an ISA.

For more information on the difference between CGI and ISA, see Internet Server API (ISAPI) Extensions in Visual C++ Programmer’s Guide.

When an ISAPI HTTP server receives a request from a client browser, a CHttpServer object is created and initialized, and a CHttpServerContext object is created. Only one instance of CHttpServer may exist for each module; however, one CHttpServerContext object is created for each call to the server. A CHttpServer object uses multiple CHttpServerContext objects to run in separate threads. This design allows simultaneous, multiple calls to the CHttpServer object by different client connections. The CHttpServer object communicates with the client or server itself via the CHttpServerContext object.

When the server loads the ISA, it calls the ISA at the entry point GetExtensionVersion to get the version number of the specification on which the extension is based. For every client request, the HttpExtensionProc member function is called. The default (recommended) implementation of HttpExtensionProc will read client data and decide what action is to be taken. You can override this member function to customize the implementation.

Other CHttpServer member functions process the client request, format the responses, and correspond with the client.

When a client command is received by a CHttpServer object, the parse maps associate the command to its class member function and parameters. Only one parse map is created per CHttpServer object.

See Internet Server API (ISAPI) Parse Maps for general information on using the parse map macros. See BEGIN_PARSE_MAP and END_PARSE_MAP for information on how to create a parse map to handle client commands.

See the following macro descriptions for information about how the client commands are mapped to member functions and their arguments:

For more information on using parse maps to handle client commands, see ISAPI Extensions: Parse Maps in Visual C++ Programmer’s Guide.

For information on debugging internet extension DLLs, see Technical Note 63.

#include <afxisapi.h>

Class MembersHierarchy Chart

Samples   MFC Sample COUNTERMFC Sample WWWQUOTE

See Also   CHtmlStream