| |
| BOOL GetNextHeader( |
| |
LPTSTR lpszHeaderName, |
|
| |
INT nMaxNameLen, |
|
| |
LPTSTR lpszHeaderValue, |
|
| |
INT nMaxValueLen |
|
| ); |
The GetNextHeader method returns the next
name/value pair in a response header enumeration.
Parameters
- lpszHeaderName
- A string buffer which will contain the name of the first header
returned by the server. If this parameter is NULL it will be
ignored.
- nMaxNameLen
- An integer which specifies the maximum number of characters
which can be copied into the lpszHeaderName string buffer,
including the terminating null. If the lpszHeaderName
parameter is NULL this value should be zero.
- lpszHeaderValue
- A string buffer which will contain the value of the first header
returned by the server. If this parameter is NULL, it will be
ignored.
- nMaxValueLen
- An integer which specifies the maximum number of characters
which can be copied into the lpszHeaderValue string buffer,
including the terminating null. If the lpszHeaderValue
parameter is NULL this value should be zero.
Return Value
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.
Remarks
This method continues the enumeration that was started when the
GetFirstHeader method was called. Repeatedly
call GetNextHeader until it returns zero (FALSE) indicating there are
no more header values to return. The GetLastError
function can be used to distinguish between an actual error condition and the
end of the enumeration. If the last error code is ST_ERROR_END_OF_DATA
then all response headers have been enumerated.
If the provided buffers are too small, the header names and values
will be truncated to the available space specified by the maximum
length parameters. In most cases, a header name is not going to exceed
256 characters and a header value will normally not exceed 5120
characters. Most header values are relatively short, but some headers
such as Set-Cookie can return much longer values.
This method cannot be called while the browser is in the process
of navigating to a new location. It will also fail if the current
document is a local file or if the document text was set dynamically
using SetDocumentText. There are no response headers
available in a local context.
Example
TCHAR szName[WEBVIEW_MAX_HEADER_NAME];
TCHAR szValue[WEBVIEW_MAX_HEADER_VALUE];
if (pWebView->GetFirstHeader(szName, _countof(szName),
szValue, _countof(szValue)))
{
do
{
_tprintf(_T("%s: %s\n"), szName, szValue);
}
while (pWebView->GetNextHeader(szName, _countof(szName),
szValue, _countof(szValue)));
}
else
{
DWORD dwError = pWebView->GetLastError();
_tprintf(_T("No headers available (error 0x%lx)\n"), dwError);
}
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: cshtmv12.lib
Unicode: Implemented as Unicode and ANSI versions
See Also
|
|