SetHeader callback function

Applies to: desktop apps only

The SetHeader callback function is used by Web filters to modify or delete the value of a header or to add a new header. The function can also be used to modify the special values included in the request or status line.

The SetHeader callback function is declared as:

Syntax

BOOL WINAPI SetHeader(
  _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 modify or delete. Header names should include the trailing colon (:). This parameter is not case-sensitive.

    The special values "method", "url", "version", and "body" (for requests only) can be used to set individual portions of the request line. When the value "body" is specified, the function sets the part of the body that has already been received.

    The special value "status" can be used to set the status in the response line.

    Note that the special values do not include a trailing colon.

  • lpszValue [in]
    Pointer to a null-terminated string containing the new string for the header, or to "\0" (if the header is to be deleted).

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_BAD_ARGUMENTS
    The value specified in the lpszName parameter is not valid for the request.

  • 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, which contains no headers.

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