AddHeader Callback Function

The AddHeader callback function adds an HTTP header to an incoming request after an SF_NOTIFY_PREPROC_HEADERS or SF_NOTIFY_AUTH_COMPLETE event notification, to an incoming response after an SF_NOTIFY_RECEIVE_RESPONSE_HEADERS notification, or to an outgoing response after an SF_NOTIFY_SEND_RESPONSE notification. For more information about the types of event notifications that are sent to Web filters, see Event Notifications.

The AddHeader callback function is declared as:

Syntax

BOOL WINAPI * AddHeader(
  __in  struct _HTTP_FILTER_CONTEXT* pfc,
  __in  LPSTR lpszName,
  __in  LPSTR lpszValue
);

Parameters

pfc

Pointer to the HTTP_FILTER_CONTEXT data structure that is associated with the current, active HTTP session. Pass the filter context in this parameter.

lpszName

Pointer to a null-terminated string containing the name of the header to add. Header names should include the trailing colon (:). This parameter is not case-sensitive.

lpszValue

Pointer to a null-terminated string containing the new value to add to the header, or to "\0" to add a header with an empty value.

Return Value

This callback function returns TRUE if the call is successful; otherwise, it returns FALSE. To obtain extended error information, call GetLastError, which may return one of the following Windows system error codes:

ERROR_SUCCESS

The header was successfully added. This error code is returned when the callback function returns TRUE.

ERROR_INVALID_PARAMETER

The value specified in the lpszValue parameter is invalid. This error code is also returned after an SF_NOTIFY_AUTH_COMPLETE notification if the filter tries to modify the URL, method, or version portion of the request line.

ERROR_NOT_ENOUGH_MEMORY

Not enough memory was available to complete the requested operation.

ERROR_NOT_SUPPORTED

The request is an HTTP 0.9 request, or the value specified in the lpszName parameter is not valid.

Remarks

A pointer to this function is included as a member of the following structures:

Requirements

Server Requires Windows Server 2008.
Version Requires Forefront Threat Management Gateway (TMG).
Header

Declared in Wpxhttpfilt.h.

DLL

Requires W3Filter.dll.

See Also

Callback Functions


Send comments about this topic to Microsoft

Build date: 11/30/2009

© 2008 Microsoft Corporation. All rights reserved.