|
BOOL GetHeader( |
|
LPCTSTR lpszHeader, |
|
|
LPTSTR lpszValue, |
|
|
INT nMaxLength |
|
); |
BOOL GetHeader( |
|
LPCTSTR lpszHeader, |
|
|
CString& strValue |
|
); |
The GetHeader method returns the value of the specified
response header field.
Parameters
- lpszHeader
- Pointer to a string which specifies the header
value to be returned.
- lpszValue
- Pointer to a buffer which will contain the null-terminated
string value of the specified header field. This may also be a
CString object which will contain the value of the header
field when the function returns.
- nMaxLength
- Maximum number of characters that may be copied into the
buffer, including the terminating null character.
Return Value
If the method succeeds, the return value is non-zero. If the
header field does not exist or the client handle is invalid, the
method returns a value of zero. To get extended error information,
call GetLastError.
Remarks
When a resource is returned by the server, it consists of three
parts. The first part consists of a single line that indicates the
result of the request. The second part is one or more header fields
which provides specific information about the resource, such as its
size in bytes. The third part consists of the resource data itself,
such as the HTML document or image data. For example, this is what
the response to a request for a simple HTML document can look
like:
HTTP/1.0 200 OK
Date: Mon, 5 Jan 2004 20:18:33 GMT
Content-Type: text/html
Last-Modified: Mon, 5 Jan 2004 19:34:19 GMT
Content-Length: 115
<html>
<head>
<title>Simple Document</title>
</head>
<body>
This is a simple HTML document.
<body>
</html>
The first line consists of the protocol version, a numeric
response code and some text describing the result. The subsequent
lines are the header, which is similar to the headers used in email
messages. For example, the Date field specifies the date the resource
was requested, the Content-Type field specifies what type of resource
was requested, and the Content-Length field specifies the size of the
resource in bytes. The end of the header block is indicated by an
empty line (two carriage-return/linefeed sequences), and is followed
by the resource itself, in this case a simple HTML document.
Requirements
Minimum Desktop Platform: Windows 7 (Service Pack 1)
Minimum Server Platform: Windows Server 2008 R2 (Service Pack 1)
Header File: cstools10.h
Import Library: cshtpv10.lib
Unicode: Implemented as Unicode and ANSI versions.
See Also
GetCookie,
GetFirstCookie,
GetFirstHeader,
GetNextCookie,
GetNextHeader,
SetHeader
|
|