CHttpFile::AddRequestHeaders

BOOL AddRequestHeaders( LPCTSTR pstrHeaders, DWORD dwFlags = HTTP_ADDREQ_FLAG_ADD_IF_NEW, int dwHeadersLen = -1 );

BOOL AddRequestHeaders( CString& str, DWORD dwFlags = HTTP_ADDREQ_FLAG_ADD_IF_NEW );

Return Value

Nonzero if successful; otherwise 0. If the call fails, the Win32 function GetLastError may be called to determine the cause of the error.

Parameters

pstrHeaders

A pointer to a string containing the header or headers to append to the request. Each header must be terminated by a CR/LF pair.

dwFlags

Modifies the semantics of the new headers. Can be one of the following:

dwHeadersLen

The length, in characters, of pstrHeaders. If this is -1L, then pstrHeaders is assumed to be zero-terminated and the length is computed.

str

A reference to a CString object containing the request header or headers to be added.

Remarks

Call this member function to add one or more HTTP request headers to the HTTP request handle.

AddRequestHeaders appends additional, free-format headers to the HTTP request handle. It is intended for use by sophisticated clients who need detailed control over the exact request sent to the HTTP server.

Note   The application can pass multiple headers in pstrHeaders or str for an AddRequestHeaders call using HTTP_ADDREQ_FLAG_ADD or HTTP_ADDREQ_FLAG_ADD_IF_NEW. If the application tries to remove or replace a header using HTTP_ADDREQ_FLAG_REMOVE or HTTP_ADDREQ_FLAG_REPLACE, only one header can be supplied in lpszHeaders.

CHttpFile OverviewClass MembersHierarchy Chart

See Also   CInternetFile