The SetHeader method defines a header field and value that
is submitted to the server when a resource is requested. If the
header field has already been defined, it will be replaced by the new
value. There are a number of header fields which are automatically
created by the library, and others that are conditionally created
depending on whether or not certain options are specified. The
following header fields are automatically created by the library:
Header Field |
Description |
Accept |
This header specifies the types of resources that are
acceptable to the client. By default, all resource data types
are accepted by the client. |
Authorization |
This header is automatically created if the client uses the
Authenticate method to authenticate a client session. |
Connection |
This header determines if the connection is maintained
after a resource has been requested, or if the connection
should be immediately closed. The value of this header depends
on whether the HTTP_OPTION_KEEPALIVE option has been
specified. |
Content-Length |
This header defines the length of the data that is being
posted to the server or the size of a file being uploaded to
the server. |
Content-Type |
This header defines the content type for data posted to the
server. This header is created if URL encoding is specified.
The specific type of encoding used can be set by calling the
SetEncodingType method. |
Host |
This header specifies the name of the server that the
client has connected to. This is automatically generated when
any resource is requested. |
Pragma |
This header is used to control caching performed by the
server. If the option HTTP_OPTION_NOCACHE has been specified,
this header will automatically be defined with the value
"no-cache". |
Proxy-Authorization |
This header is automatically created if a proxy connection
has been established and a username and password is required to
authenticate the client session. |
Request headers are generated by methods that send resource
requests. In some cases, header values are supplied by the requesting
method only if the application has not previously defined the header.
For others, the requesting method overrides what the application may
have defined.
If you use this method to set the Authorization header to a
custom value for this client session, you must not call the
Authenticate method. The Authenticate
method will always override any custom Authorization header value
and replace it with the credentials token generated from the username
and password provided.