HTTPREQUEST  
 

The HTTPREQUEST structure provides information about the request made by the client.

typedef struct _HTTPREQUEST
{
    DWORD  dwSize;
    DWORD  dwFlags;
    DWORD  dwVersion;
    DWORD  dwAccess;
    DWORD  dwLength;
    DWORD  dwReserved;
    UINT   nHostId;
    UINT   nHostPort;
    LPCSTR lpszCommand;
    LPCSTR lpszHostName;
    LPCSTR lpszUserName;
    LPCSTR lpszPassword;
    LPCSTR lpszResource;
    LPCSTR lpszParameters;
    LPCSTR lpszDirectory;
    LPCSTR lpszPathInfo;
    LPCSTR lpszProgram;
    LPCSTR lpszScriptFile;
    LPCSTR lpszLocalFile;
    LPCSTR lpszMediaType;
} HTTPREQUEST, *LPHTTPREQUEST;

Members

dwSize
An unsigned integer value that specifies the size of the structure.
dwFlags
An unsigned integer value that provides additional information about the request. It may be one or more of the following values:
Value Description
HTTP_REQUEST_FLAG_PROTECTED The resource that the client has requested is protected. The client should only be permitted to access the resource if the client session has been authenticated.
HTTP_REQUEST_FLAG_PROGRAM The resource that the client has requested is a CGI program or an executable script. The output from the program or script should be returned to the client in the response. If this flag is specified, the lpszProgram member of the structure specifies the name of the program that should be executed.
HTTP_REQUEST_FLAG_SCRIPT The resource that the client has requested is an executable script. This flag is set when the request URL is mapped to a registered script handler. The lpszProgram member specifies the name of the program that is responsible for executing the script, and the lpszScriptFile parameter specifies the full path to the script itself.
dwVersion
An unsigned integer value that specifies the protocol version used. It may be one of the following values:
Value Description
HTTP_VERSION_09 The client issued a GET command without specifying a protocol version.
HTTP_VERISON_10 The client issued a command that specified version 1.0 of the protocol.
HTTP_VERSION_11 The client issued a command that specified version 1.1 of the protocol.
dwAccess
An unsigned integer value that specifies the access permissions that were assigned to the resource. For a list of file access permissions, see User and File Access Constants.
dwLength
An unsigned integer value that will specify the number of bytes of request data provided by the client. If the client did not submit any data with the request, this member will have a value of zero.
dwReserved
An unsigned integer value that is reserved for future use.
nHostId
An integer value that identifies the virtual host that was specified by the client. This is based on the value of the Host request header included in the request. This value will be zero if a host name is not specified by the client, or does not match one of the virtual hosts that have been created.
nHostPort
An integer value that specifies the port number that the client used to establish the connection. This will be the same port number that was used when starting the server.
lpszCommand
A pointer to a string that specifies the command that was issued by the client. The command will always be in upper case. Refer to Hypertext Transfer Protocol Commands for a list of standard commands.
lpszHostName
A pointer to a string that identifies the hostname or IP address that the client used to establish the connection. This will typically correspond to the hostname assigned to the server, or to one of the virtual hosts that have been created.
lpszUserName
A pointer to a string that specifies the username provided with the request. This member is only set if the client has included authentication credentials as part of the request. If the client has not provided any credentials, this member will be NULL.
lpszPassword
A pointer to a string that specifies the password provided with the request. This member is only set if the client has included authentication credentials as part of the request. If the client has not provided any credentials, this member will be NULL.
lpszResource
A pointer to a string that specifies the URL path provided by the client.
lpszParameters
A pointer to a string that specifies any query parameters that were included in the request made by the client. If the URL did not include any query parameters, this member will be NULL.
lpszDirectory
A pointer to a string the specifies the full path to the root directory for the virtual host.
lpszPathInfo
A pointer to a string that specifies additional path information provided by the client when referencing an executable CGI program or script in the URL. For example, if a program is mapped to the virtual path "/orders/invoice" and the client requests "/orders/invoice/pdf/10001" this member will be the string "/pdf/10001". If there is no path information associated with the request, this member will be NULL.
lpszProgram
A pointer to a string that specifies the local path to the CGI program that should be executed to process the request made by the client. If this member is NULL, it indicates that the client has provided a URL that maps to a local file or directory.
lpszScriptFile
A pointer to a string that specifies the local path to the script file that will be executed by the handler. If this member is NULL, it indicates that the request URL was not mapped to registered script handler.
lpszLocalFile
A pointer to a string that specifies the local path to the directory or file name referenced by the URL. If the lpszPathInfo member is not NULL, then this member will point to a local file name based the path information appended to the root directory for the virtual host.
lpszMediaType
A pointer to a string that identifies the request data using the standard Internet media types defined in RFC 2046. It is used to designate the format for various types of content and has two parts, a primary and secondary media type separated by a forward slash. Common examples are "text/plain", "text/html" and "application/octet-stream". If the client did not submit any data with the request, this member will be NULL.

Remarks

This structure is used with the ReceiveRequest method and all members should be initialized to a value of zero, except for the dwSize member which should be initialized to size of the structure. Failure to properly initialize the structure will cause the method call to fail.

The value of the lpszLocalFile member depends on whether the client has requested a static document, or if the URL is mapped to a registered program or script handler. If the request is for a static document, then the dwFlags member will not have the HTTP_REQUEST_FLAG_PROGRAM bit flag set and the lpszLocalFile member will be the full path to the document. If the URL is mapped to a registered program or script, then the lpszLocalFile member will be the full path to the server root directory, If the request URL included additional path information, that will be appended to the root directory.

The value of the lpszScriptFile member is only defined if the dwFlags member has the HTTP_REQUEST_FLAG_SCRIPT bit flag set. This indicates that the request URL references a file that is an executable script with a handler that was registered using the RegisterHandler method.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools11.h
Unicode: Implemented as Unicode and ANSI versions

See Also

ReceiveRequest, SendResponse, HTTPRESPONSE