The HttpExtensionProc function is the main entry point for an ISAPI extension called by IIS. It exposes methods that IIS uses to access the functionality exposed by the extension.
DWORD WINAPI HttpExtensionProc(
LPEXTENSION_CONTROL_BLOCK lpECB
);
Returns a DWORD containing HSE_STATUS codes. Possible return values are:
Value | Meaning |
HSE_STATUS_SUCCESS | The extension has finished processing and the server should disconnect the client and free up allocated resources. |
HSE_STATUS_SUCCESS_AND_KEEP_CONN | The extension has finished processing and the server should wait for the next HTTP request if the client supports Keep-Alive connections. The extension can return this only if it was able to send the correct Content-Length header to the client. |
HSE_STATUS_PENDING | The extension has queued the request for processing and will notify the server when it has finished. See HSE_REQ_DONE_WITH_SESSION under ServerSupportFunction.
If the ISAPI extension is using HSE_STATUS_PENDING, then responses can be sent from work done in another thread after returning HSE_STATUS_PENDING. |
HSE_STATUS_ERROR | The extension has encountered an error while processing the request, so the server can disconnect the client and free up allocated resources. An HTTP status code of 500 is written to the IIS log for the request. |
This entry point is similar to a main() function in a C++ program. The code in this entry point uses callback functions in the EXTENSION_CONTROL_BLOCK to read client data and decide which action to take. Before returning to the server, a properly formatted response must be sent to the client through either WriteClient or ServerSupportFunction. Return codes are defined in httpext.h.
Important In IIS versions 4.0 and later, the return values HSE_STATUS_SUCCESS and HSE_STATUS_SUCCESS_AND_KEEP_CONN are functionally identical: Keep-Alive connections are maintained, if supported by the client.