Share via


AddResponseHeaders callback function

Applies to: desktop apps only

The AddResponseHeaders callback function adds a header to the HTTP response, if the response was created by Forefront TMG.

The AddResponseHeaders callback function is declared as:

Syntax

BOOL WINAPI AddResponseHeaders(
  _In_  struct _HTTP_FILTER_CONTEXT *pfc,
  _In_  LPSTR lpszHeaders,
  _In_  LPSTR dwReserved
);

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.

  • lpszHeaders [in]
    Pointer to a null-terminated string containing a string that contains the headers to add. The string should be in the following format:

    header1:value1\r\nheader2:value2\r\n
    

    The string may contain one or more headers. Each header and value pair must be terminated by "\r\n".

  • dwReserved [in]
    Reserved for future use. This must be zero.

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.

  • ERROR_NOT_ENOUGH_MEMORY
    Not enough memory was available to complete the requested operation.

Remarks

The AddResponseHeaders callback function can be used to add headers to responses for clients before the server processes the request, but not during or after SF_NOTIFY_ACCESS_DENIED or SF_NOTIFY_SEND_RESPONSE notifications. You can add a header when the SF_NOTIFY_SEND_RESPONSE notification occurs by using the AddHeader member of the HTTP_FILTER_SEND_RESPONSE structure.

Headers are added by AddResponseHeaders only for responses generated by Forefront TMG, such as error pages, where SF_NOTIFY_SEND_RESPONSE is triggered. Use SF_NOTIFY_SEND_RAW_DATA to add headers to all responses. For more information about the types of event notifications that are sent to Web filters, see Event Notifications.

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