Share via


SetHeader

The SetHeader callback function is used by ISAPI filters to change or delete the value of a header. The function can be used to change the special values included in the request line.

BOOL WINAPI * SetHeader(
   PHTTP_FILTER_CONTEXT pfc,
   LPSTR lpszName,
   LPSTR lpszValue
);

Parameters

  • pfc
    Points to the HTTP_FILTER_CONTEXT Structure that is associated with the current, active HTTP transaction.

  • lpszName
    Points to the name of the header to change or delete.

  • lpszValue
    Points to the new string for the header, or to '\0' (to delete the header).

Return Values

Returns true if the function was successful; otherwise false. The GetLastError function indicates the reason for failure. The most common reason is as follows:

Return code

Description

ERROR_INVALID_PARAMETER

If pfc or the server context that pfc points to is invalid. Additionally, if the header name does not end with a colon (:) or if the header contains either a carriage return ('\r') or line feed ('\n') character.

ERROR_NOT_SUPPORTED

If the header is not supported by the HTTP version.

Remarks

The special values "method", "url", and "version" can be used in SF_NOTIFY_PREPROC_HEADERS or SF_NOTIFY_AUTH_COMPLETE to retrieve the individual portions of the request line. The special value "status" can be used in SF_NOTIFY_SEND_RESPONSE to retrieve the entire response line. The special values must not include the trailing colon and should be lower-case.

Requirements

Client: Requires Windows XP Professional, Windows 2000 Professional, or Windows NT Workstation 4.0.

Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.

Product: IIS

Header: Declared in httpfilt.h.