AddHeader callback function

Applies to: desktop apps only

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 [in]
    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 [in]
    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 [in]
    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

Minimum supported client

None supported

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 (64-bit only)

Version

Forefront Threat Management Gateway (TMG) 2010

Header

Wpxhttpfilt.h

See also

Callback Functions

 

 

Build date: 7/12/2010