ServerSupportFunction

The ServerSupportFunction is a callback function that is supplied in the ECB (EXTENSION_CONTROL_BLOCK). It supports several auxiliary functions that are not covered by other explicit callback functions in the ECB.

BOOL ServerSupportFunction(
  HCONN ConnID,         
  DWORD dwHSERRequest,  
  LPVOID lpvBuffer,     
  LPDWORD lpdwSize,     
  LPDWORD lpdwDataType  
);
 

Parameters

ConnID
Specifies the logical connection identifier of the client to which the response data should be sent.
dwHSERRequest
Specifies a DWORD that contains the HTTP Server Extension Request type which indicates the functions the ISAPI extension requested . Possible values are:
Value Meaning
HSE_APPEND_LOG_PARAMETER Appends a string to the log record being written out to the log file.
HSE_REQ_ABORTIVE_CLOSE Requests an abortive close on disconnect for this connection. Abortive close is one of the two types of closes (the other is graceful close) available for TCP sockets. In an abortive close the server forces an immediate close of the connection once the data is sent. Generally, the abortive close performs much better than the graceful close.
HSE_REQ_ASYNC_READ_CLIENT Enables the ISAPI extension to perform an aynchronous read from the client. The extension should submit a callback function and context by calling ServerSupportFunction with HSE_REQ_IO_COMPLETION specified. If this is not done, the call will fail and the serer will return ERROR_INVALID_PARAMETER. If the read completes with zero bytes read, then the client has closed their connection gracefully so the operation should be terminated.

If this value is specified, the only supported value for lpdwDataType is HSE_IO_ASYNC.

HSE_REQ_DONE_WITH_SESSION Specifies that if the server extension holds on to the session because of extended processing requirements, the server must be notified when the session is finished so the server can close it and free its related structures. The parameters lpdwSize, and lpdwDataType are ignored. The lpvBuffer parameter may optionally point to a DWORD that contains HSE_STATUS codes. IIS recognizes HSE_STATUS_SUCCESS_WITH_KEEP_CONN for keeping the IIS connection alive if the client also requests to keep the connection alive. This parameter must be sent to the server if the HSE_IO_DISCONNECT_AFTER_SEND parameter has been included in the HSE_TF_INFO structure as part of a HSE_REQ_TRANSMIT_FILE request. This parameter will explicitly close the connection.
HSE_REQ_GET_CERT_INFO_EX Specifies the certificate context for the first certificate in the client's certificate chain.

This option depends upon two structures: the CERT_CONTEXT_EX structure.which contains an embedded CERT_CONTEXT structure.

The CERT_CONTEXT structure contains an embedded buffer, which will hold the certificate.

To use this option, the caller must: 1) instantiate a CERT_CONTEXT_EX structure; 2) allocate the buffer embedded within the CERT_CONTEXT structure; and 3) pass HSE_REQ_GET_CERT_INFO_EX as the second parameter, and the address of the CERT_CONTEXT_EX structure as the third parameter to ServerSupportFunction.

HSE_REQ_GET_IMPERSONATION_TOKEN Specifies a handle to the impersonation token that the request is running. An impersonation token is a handle that represents a user context. Before resources, such as files and registry keys are opened, the thread should be impersonated first with either the ImpersonateLoggedOnUser or SetThreadToken Win32® API. The impersonation token returned by HSE_REQ_GET_IMPERSONATION_TOKEN can be used with these APIs.

The token is owned by IIS. The ISAPI DLL should not call CloseHandle on this token. The lifetime of the token lasts until the current request's ECB is destroyed.

The lpvBuffer parameter points to the HANDLE that will contain the impersonation token.

HSE_REQ_GET_SSPI_INFO Specifies the CtxtHandle and CredHandle structures, as defined in sspi.h, for the server's certificate chain.

The caller can then use these handles to query or manipulate the server certificate information through the standard certificate API's defined in sspi.h.

To use this option, the caller must first instantiate CtxtHandle and CredHandle structures, then pass HSE_REQ_GET_SSPI_INFO as the second parameter, the address of the CtxtHandle structure as the third parameter, and the address of the CredHandle structure as the fifth parameter to ServerSupportFunction.

NOTE: This option is not supported if your extension is running in a separate process from IIS.

HSE_REQ_IO_COMPLETION Enables the ISAPI extension to set a callback function and context that will be used for handling asynchronous I/O operations. The callback function is PFN_HSE_IO_COMPLETION

The callback function is used only if the function pointer passed is non-NULL. Any context value is allowed. If multiple calls are made for this option, the values used in the most recent call to ServerSupportFunction will be used. All old values will be lost.

In case of errors during asynchronous I/O processing, the server makes a single call to the callback function. It is the responsibility of the ISAPI extension to do the cleanup during the call.

When this option is used, lpvBuffer points to the callback function for asynchronous I/O completion and lpdwDataType contains the Context value to use for the callbacks.

HSE_REQ_IS_KEEP_CONN Obtains the keep-alive status of the connection. If this option is used, lpvBuffer points to a BOOL which will contain the state on return.
HSE_REQ_MAP_URL_TO_PATH Specifies that the lpvBuffer parameter points to the buffer that contains the logical path on entry and the physical path on exit. The lpdwSize parameter points to the DWORD containing the size of the buffer passed in lpvBuffer on entry, and the number of bytes placed in the buffer on exit. The lpdwDataType parameter is ignored.
HSE_REQ_MAP_URL_TO_PATH_EX This is an improved version of the HSE_REQ_MAP_URL_TO_PATH function. This version requires that you provide a pointer to the HSE_URL_MAPEX_INFO structure in the lpdwDataType parameter. IIS will fill populate this structure with information concerning the URL, such as any attributes values that have been set.
HSE_REQ_REFRESH_ISAPI_ACL Forces the server to update the ISAPI DLL ACL dynamically. This option forces the server to re-read the ACL for the ISAPI DLL. If this option is used LpvBuffer is a string that contains the name of the ISAPI DLL.
HSE_REQ_SEND_URL_REDIRECT_RESP This option sends a 302 message (URL Redirect) to the client. No further processing is needed after the call. This operation is similar to specifying URI: <URL> in a CGI script header. With this option, the lpvBuffer variable points to a null-terminated string of URL. The variable lpdwSize should have the size of lpvBuffer. The variable lpdwDataType is ignored.
HSE_REQ_SEND_URL Sends the data specified by the URL to the client as if the client had requested that URL. The null-terminated URL pointed to by lpvBuffer must be on the server and must not specify protocol information (that is, it must begin with a /). No further processing is required after this call. This value should only be used if you are not sending any response back to the client. The parameter lpdwSize points to a DWORD holding the size of lpvBuffer. The parameter lpdwDataType is ignored.

Support for this value is for compatability with earlier versions of ISAPI. HSE_REQ_SEND_URL_EX should be used instead.

HSE_REQ_SEND_URL_EX Similar to HSE_REQ_SEND_URL; however, it adds support for specifying the verb to use in the redirect.
HSE_REQ_SEND_RESPONSE_HEADER Sends a complete HTTP server response header, including the status, server version, message time, and MIME version. The ISAPI extension should append other HTTP headers such as the content type and content length, followed by an extra \r\n. This option allows the function to take only text, up to the first \0 terminator. The function with this parameter should only be called once per request.
HSE_REQ_SEND_RESPONSE_HEADER_EX This is an improved version of HSE_REQ_SEND_RESPONSE_HEADER. This new version allows your extension to specify whether the connection should be kept open through the fKeepConn member of the HSE__SEND_HEADER_EX_INFO structure. You can also use this structure to indicate the lengths of the header and status strings, which will provide better performance than using HSE_REQ_SEND_RESPONSE_HEADER.

This function requires that a pointer to the HSE_SEND_HEADER_EX_INFO structure be included in the lpvbuffer parameter.

HSE_REQ_TRANSMIT_FILE Enables the ISAPI extension to use the Win32 TransmitFile function to send a file to the client. The server performs this operation asynchronously. The extension should either submit a callback function (and context) by setting the values in the HSE_TF_INFO object passed in or should have called ServerSupportFucntion with HSE_REQ_IO_COMPLETION set. If none of the above is done, this call will fail and the server will return an ERROR_INVALID_PARAMETER. Also, the extension should specify the file handle in the structure that is passed in. If all parameters are present, the server submits this operation to its internal asynchronous I/O queue and returns to the caller. The ISAPI extension can at this point return HSE_STATUS_PENDING, if returning from HttpExtenionProc, and later on use HSE_DONE_WITH_SESSION, when the callback that indicates I/O has completed occurs.

If this option is used, lpvBuffer points to the HSE_TF_INFO object. lpdwSize and
lpdwDataType are both ignored.



lpvBuffer
Points to a buffer. The contents of the buffer will vary, depending on the value set for the dwHSERRequest parameter. Details are provided in the table of possible values for the dwHSERRequest parameter.
lpdwSizeofBuffer
Points to a DWORD. The meaning of the DWORD will vary, depending on the value set for the dwHSERRequest parameter. Details are provided in the table of possible values for the dwHSERRequest parameter.
lpdwDataType
Points to a DWORD. The meaning of the DWORD will vary, depending on the value set for the dwHSERRequest parameter. Details are provided in the table of possible values for the dwHSERRequest parameter.

© 1997 by Microsoft Corporation. All rights reserved.