IXMLHTTPRequest2::GetAllResponseHeaders method (msxml6.h)

Retrieves the values of all the HTTP response headers.

Syntax

HRESULT GetAllResponseHeaders(
  [out] WCHAR **ppwszHeaders
);

Parameters

[out] ppwszHeaders

The returned header information. Free the memory used for this parameter using the CoTaskMemFree method.

Return value

Returns S_OK on success.

Remarks

Each header name/value pair is separated by a combination carriage return-line feed.

The returned response header information is only valid after the OnHeadersAvailable callback method has been called.

Examples

HRESULT hr = S_OK;
WCHAR *pwszHeaderValue = NULL;
IXMLHTTPRequest2 *pIXMLHTTPRequest2 = NULL;

// Create IXMLHTTPRequest2 object and initialize pIXMLHTTPRequest2.
hr = pIXMLHTTPRequest2->GetAllResponseHeaders(&pwszHeaderValue);
if(SUCCEEDED(hr))
{
  MessageBox(NULL, pwszHeaderValue, L"All Response Headers", MB_OK);
}

if (pwszHeaderValue != NULL)
{
      CoTaskMemFree(pwszHeaderValue);
      pwszHeaderValue = NULL;
}

// Release pIXMLHTTPRequest2 when finished with it.

Requirements

Requirement Value
Minimum supported client Windows 8 [desktop apps | UWP apps],MSXML 6.0 and later
Minimum supported server Windows Server 2012 [desktop apps | UWP apps]
Target Platform Windows
Header msxml6.h

See also

CoTaskMemFree

IXMLHTTPRequest2

OnHeadersAvailable