If the method succeeds, the return value is non-zero. If the method
fails, the return value is zero. To get extended error information, call
GetLastError. If the header name contains illegal characters or
cannot be changed (e.g., attempting to change the Authorization
header), the method 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.
The SetHeader method 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 method 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 method. 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 ClearHeaders method, the
ResetSession method is called, or the connection is closed using
the Disconnect method.