| |
| BOOL WINAPI LlmSetRequestHeader( |
| |
HCLIENT hClient, |
|
| |
LPCTSTR lpszHeaderName, |
|
| |
LPTSTR lpszHeaderValue |
|
| ); |
The LlmSetRequestHeader function sets the value of a
custom HTTP header issued with subsequent requests.
Parameters
- hClient
- A handle to the client session.
- lpszHeaderName
- A pointer to a null-terminated string which specifies the name
of the HTTP header field. 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 null-terminated string which specifies the value
of the HTTP header. Header
values cannot contain carriage-return or linefeed characters. If the
value contains Unicode characters, they will be UTF-8 encoded. If
this parameter or NULL or a zero-length string, the header field is
deleted from the request headers.
Return Value
If the function succeeds, the return value is non-zero. If the function
fails, the return value is zero. To get extended error information, call
LlmGetLastError. If the header name contains illegal characters or
cannot be changed (e.g., attempting to change the Authorization
header), the function will return zero and the last error code will be set to
ST_ERROR_INVALID_HEADER_NAME. If the header value contains
illegal characters, the last error code will be set to
ST_ERROR_INVALID_HEADER_VALUE.
Remarks
The LlmSetRequestHeader function assigns a custom HTTP request
header that will be included with subsequent requests made using the
current client session. If the specified header already exists in the
custom header list, its value will be replaced. If the header value
is an empty string, the header will be removed.
This function is intended for advanced applications that require lower-level
access to provider-specific functionality. Most applications should not
need to use custom request headers. Some headers are managed internally by
the library and cannot be overridden using this function. This includes headers
required for authentication, content formatting, message length, host
identification, and other protocol-specific functionality required by the
current provider.
Examples of headers that are managed internally by the library include:
Authorization
Content-Length
Content-Type
Host
User-Agent
Custom headers remain associated with the current client session
until they are removed using the LlmClearHeaders function, the
LlmResetSession function is called, or the connection is closed
using the LlmDisconnect function.
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
LlmClearHeaders,
LlmDisconnect,
LlmGetResponseHeader,
LlmResetSession,
LlmSendMessage,
LlmSetUserAgent
|
|