LlmGetResponseHeader Function  
 
INT WINAPI LlmGetResponseHeader(
  HCLIENT hClient,  
  LPCTSTR lpszHeaderName,  
  LPTSTR lpszHeaderValue,  
  INT nMaxLength  
);

The LlmGetResponseHeader function returns the value of an HTTP header from the server response.

Parameters

hClient
A handle to the client session.
lpszHeaderName
A pointer to a null-terminated string which specifies the name of the HTTP response header. The header names are not case-sensitive. Header names may only contain ASCII letters, numbers and a restricted subset of punctuation characters. Header names cannot contain Unicode or ANSI multi-byte character sequences.
lpszHeaderValue
A pointer to a string buffer which will contain the header value when the function returns. If this parameter is NULL, the header value will not be copied and the function will return the length. If the buffer is not large enough to contain the entire header value, it will be truncated.
nMaxLength
An integer which specifies the maximum number of characters which can be copied into the lpszHeaderValue string buffer. If lpszHeaderValue is NULL, this value should be zero. The maximum length must include room for the terminating null character.

Return Value

If the function succeeds, the return value is the length of the header value in characters, not including the terminating null character. If the header is undefined or the function fails, the return value is zero. To get extended error information, call LlmGetLastError. If the header field does not exist, the error code will be ST_ERROR_HEADER_NOT_FOUND.

Remarks

The LlmGetResponseHeader function returns the value of a response header from the last request made to the service provider.

This function is intended for applications that need lower-level access to provider-specific response headers. Most applications do not need to call this function. Standard response information, such as the HTTP status code, response text, token usage, model name, and elapsed time, is available through the API.

The headers returned by a service provider can vary depending on the provider, model, endpoint, account configuration, and the specific request being made. Applications should not assume that a particular header will always be present unless it is documented by the service provider.

If the header field specified by lpszHeaderName was not returned by the server, this function will return zero. If the lpszHeaderValue parameter is not NULL, it will contain an empty string when the function returns. The response headers are only available after a request has been sent to the server.

Requirements

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

See Also

LlmResetSession, LlmSendMessage, LlmSetRequestHeader