Microsoft Internet Security and Acceleration Server 2000

GetServerVariable

Pointer to a function that retrieves information about the server and this connection. For some notifications, some variables might not be defined. For example, notifications that occur before PREPROC_HEADERS, such as the READ_RAW_DATA notification, may not be defined.

Some server variables, such as Request_Method and Content_Length are embedded in the EXTENSION_CONTROL_BLOCK structure. You can use GetServerVariable to obtain information about the request or server that is not included in the EXTENSION_CONTROL_BLOCK.

The declaration of GetServerVariable is:

BOOL WINAPI GetServerVariable(
  HCONN hConn, 
  LPSTR lpszVariableName, 
  LPVOID lpvBuffer, 
  LPDWORD lpdwSizeofBuffer 
);

Parameters

hConn
Specifies the connection handle.
lpszVariableName
A null-terminated string that indicates which variable is requested. The following table lists the possible variables. Variables supported by IIS, but not by ISA, are presented in this table, along with information on how the ISA Web proxy service responds to the variable.
Variable Description
ALL_HTTP Retrieves all HTTP headers that were received. These variables are of the form HTTP_header field name. The headers consist of a null-terminated string with the individual headers separated by line feeds.
ALL_RAW Retrieves all headers in raw form. The header names and values appear as they are sent by the client. Currently, this value is primarily used by proxy servers and similar applications.
APPL_MD_PATH Not supported in ISA; will always return the error (ERROR_INVALID_INDEX).
APPL_PHYSICAL_PATH Not supported in ISA; will always return the error (ERROR_INVALID_INDEX).
AUTH_PASSWORD Specifies the value entered in the client's authentication dialog box. This variable is only available if basic authentication is used.
AUTH_TYPE Specifies the type of authentication used. If the string is empty, then no authentication is used. Possible values are Kerberos, user, Secure Sockets Layer (SSL) or Private Communication Technology (PCT), basic, and integrated Windows authentication.
AUTH_USER Specifies the value entered in the client's authentication dialog box.
CERT_COOKIE Specifies a unique identifier (ID) for a client certificate. Returned as a string. Can be used as a signature for the entire client certificate.
CERT_FLAGS If bit0 is set to 1, a client certificate is present. If bit1 is set to 1, the certification authority (CA) of the client certificate is invalid; that is, it is not on this server's list of recognized CAs.
CERT_ISSUER Specifies the issuer field of the client certificate. For example, the codes might be O=MS, OU=IAS, CN=user name, C=USA, and so on.
CERT_KEYSIZE Specifies the number of bits in the SSL connection key size.
CERT_SECRETKEYSIZE Specifies the number of bits in the server certificate private key.
CERT_SERIALNUMBER Specifies the serial-number field of the client certificate.
CERT_SERVER_ISSUER Specifies the issuer field of the server certificate.
CERT_SERVER_SUBJECT Specifies the subject field of the server certificate.
CERT_SUBJECT Specifies the subject field of the client certificate.
CONTENT_LENGTH Specifies the number of bytes of data that the script or extension can expect to receive from the client. This total does not include headers.
CONTENT_TYPE Specifies the content type of the information supplied in the body of a request for a power-on self test (POST).
LOGON_USER The Windows account that the user is logged into.
HTTPS Returns On if the request came in through a secure channel (with SSL encryption), or Off if the request is for an unsecure channel.
HTTPS_KEYSIZE Specifies the number of bits in the SSL connection key size.
HTTPS_SECRETKEYSIZE Specifies the number of bits in server certificate private key.
HTTPS_SERVER_ISSUER Specifies the issuer field of the server certificate.
HTTPS_SERVER_SUBJECT Specifies the subject field of the server certificate.
INSTANCE_ID Not supported in ISA; will always return the error (ERROR_INVALID_INDEX).
INSTANCE_META_PATH Not supported in ISA; will always return the error (ERROR_INVALID_INDEX).
PATH_INFO Not supported in ISA; will always return the error (ERROR_INVALID_INDEX).
PATH_TRANSLATED Not supported in ISA; will always return the error (ERROR_INVALID_INDEX).
QUERY_STRING Not supported in ISA; will always return an empty string.
REMOTE_ADDR Specifies the IP address of the client or agent of the client (for example gateway, proxy, or firewall) that sent the request.
REMOTE_HOST Specifies the host name of the client or agent of the client (for example, gateway, proxy or firewall) that sent the request if reverse Domain Name System (DNS) is enabled. Otherwise, this value is set to the IP address specified by REMOTE_ADDR.
REMOTE_USER Specifies the user name supplied by the client and authenticated by the server. This comes back as an empty string when the user is anonymous.
REQUEST_METHOD Specifies the HTTP request method verb.
SCRIPT_NAME Not supported in ISA; will always return "w3proxy.dll".
SERVER_NAME Specifies the server's host name, or IP address, as it should appear in self-referencing URLs.
SERVER_PORT Specifies the TCP/IP port on which the request was received.
SERVER_PORT_SECURE Specifies a string of either 0 or 1. If the request is being handled on the secure port, then this will be 1. Otherwise, it will be 0.
SERVER_PROTOCOL Specifies the name and version of the information retrieval protocol relating to this request.
SERVER_SOFTWARE Returns "Microsoft-ISA/3.0".
URL Will return the request URL (after the request has been parsed). HTTP_Proxy_URL will also return this value.

lpvBuffer
Points to the buffer to receive the requested information.
lpdwSizeofBuffer
Points to a DWORD data type that indicates the size of the buffer pointed to by lpvBuffer. On successful completion, the DWORD contains the size of bytes transferred into the buffer, including the null-terminating byte.

Return Values

If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE. The Win32® GetLastError function can be used to determine why the call failed. The following are the possible error values.

ERROR_INVALID_PARAMETER
Bad connection handle or invalid values in either lpszVariableName or lpdwSizeofBuffer.
ERROR_INVALID_INDEX
Bad or unsupported variable identifier.
ERROR_INSUFFICIENT_BUFFER
Buffer too small. The required buffer size is *lpdwSizeofBuffer.
ERROR_NO_DATA
The data requested is not available.