The HttpExtensionProc function is the main entry point for an ISAPI extension called by IIS. It exposes methods to which 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 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 persistent connections. The extension should only return this if it was able to send the correct Content-Length header to the client. The server is not required to keep the session open. |
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 the status pending. |
HSE_STATUS_ERROR | The extension has encountered an error while processing the request and the server can disconnect and free up allocated resources. |
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 on the 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.