HttpGetRequestHeader Function  
 
BOOL WINAPI HttpGetRequestHeader(
  HCLIENT hClient,  
  LPCTSTR lpszHeader,  
  LPTSTR lpszValue,  
  INT nMaxLength  
);

The HttpGetRequestHeader function returns the value of the specified request header field.

Parameters

hClient
Handle to the client session.
lpszHeader
Pointer to a string which specifies the header value to be returned.
lpszValue
Pointer to a buffer which will contain the null-terminated string value of the specified header field.
nMaxLength
Maximum number of characters that may be copied into the buffer, including the terminating null character.

Return Value

If the function succeeds, the return value is non-zero. If the header field does not exist or the client handle is invalid, the function returns a value of zero. To get extended error information, call HttpGetLastError.

Remarks

When a resource is requested from the server, it consists of two parts. The first part is the command issued to the server, along with the name of the resource and any optional encoded parameters. The second part consists of one or more header fields which can be used to provide additional information to the server. For example, here is what the command and header may look like for a simple request:

GET /test HTTP/1.0
Host: api.sockettools.com
Accept: text/*

The first line consists of the command, the resource and the protocol version. The subsequent lines are the header, which is similar to the headers used in email messages. The Host field specifies the name of the server the resource is being requested from, and the Accept field specifies the type of resources that are acceptable to the client; in this case, any type of text file.

Requirements

Minimum Desktop Platform: Windows 7 (Service Pack 1)
Minimum Server Platform: Windows Server 2008 R2 (Service Pack 1)
Header File: cstools10.h
Import Library: cshtpv10.lib
Unicode: Implemented as Unicode and ANSI versions.

See Also

HttpGetResponseHeader, HttpSetRequestHeader