NAME

HTTP_FILTER_PREPROC_HEADERS - ISAPI access to HTTP headers.


SYNOPSIS

 #include "httpfilt.h"
 typedef struct _HTTP_FILTER_PREPROC_HEADERS {
   BOOL    (WINAPI * GetHeader) (PHTTP_FILTER_CONTEXT pfc,
                                 LPSTR    lpszName,
                                 LPVOID   lpvBuffer,
                                 LPDWORD  lpdwSize);
   BOOL    (WINAPI * SetHeader) (PHTTP_FILTER_CONTEXT pfc,
                                 LPSTR    lpszName,
                                 LPSTR    lpszValue);
   BOOL    (WINAPI * AddHeader) (PHTTP_FILTER_CONTEXT pfc,
                                 LPSTR    lpszName,
                                 LPSTR    lpszValue);
   DWORD    HttpStatus; /* For SEND_RESPONSE */ 
   DWORD    dwReserved;
 } HTTP_FILTER_PREPROC_HEADERS, *PHTTP_FILTER_PREPROC_HEADERS,
   HTTP_FILTER_SEND_RESPONSE,   *PHTTP_FILTER_SEND_RESPONSE;


DESCRIPTION

HTTP_FILTER_PREPROC_HEADERS provides a filter with access to the HTTP headers received from a client: it is synonymous with HTTP_FILTER_SEND_RESPONSE, which provides a filter with access to the headers sent back to the client. When HttpFilterProc is invoked with NotificationType set to SF_NOTIFY_PREPROC_HEADERS or SF_NOTIFY_SEND_RESPONSE, its pvNotification points to a structure of this type which the HttpFilterProc can use (along with the data in its HTTP_FILTER_CONTEXT) to either preprocess the headers received from the client or post-process the headers to be sent to the client.


DATA FIELDS

The HttpStatus field is used, for the SF_NOTIFY_SEND_RESPONSE notification, to communicate the HTTP status code of the response: the filter may need to know this to perform its processing and can even alter it, if appropriate.

The second data field, dwReserved, should be ignored. It is `reserved for future use'.


FUNCTION FIELDS

The other fields of the structure are pointers to functions. Each expects to be called with, as first argument, the HTTP_FILTER_CONTEXT received by the call to HttpFilterProc which invoked it. The second argument is interpreted as a header name.

Three special `headers' are supported, ``method'', ``url'' and ``version'', each entirely lower-case and without a trailing `:', providing access to portions of the first line of the HTTP request; for instance, if the first line says `GET /here/ HTTP/1.1', method will be ``GET'', url will be ``/here/'' and version will be ``HTTP/1.1''.

All other headers are recognized case-insensitively (e.g. ``ConTent-Type'' and ``content-type'' are equivalent) and a trailing ``:'' is optional. Thus the names ``method:'', ``mEtHoD:'' and ``Method'' are equivalent, though distinct from the pseudo-header name ``method''.

GetHeader

Reads a header, specified by name, into a buffer provided by the caller. Parameter lpdwSize should point to a DWORD holding the size of the area of memory whose start is pointed to by lpvBuffer. If this is enough space for the value of the header associated with lpszName, this value is copied into the area of memory, the DWORD indicated by lpdwSize is updated to state the length of the value and GetHeader returns TRUE. If the named header has a value but this value is too long to fit in the given area of memory, GetHeader will still set the DWORD indicated by lpdwSize to the length of the value, but will return FALSE and set the ANSI C global errno to ENOMEM. The caller can recognize this failure, read the size, allocate enough space and make a second call to AddHeader.

SetHeader

Modifies a header, possibly destroying its prior value; can also be used to delete a header (supply an empty string as the value).

AddHeader

Adds a header, or extends an existing header.

If an empty string is supplied as value, this will delete the header, as for SetHeader.

A request to add to one of the three special headers is treated as a request to set that header to the given value, rather than as a request to add to the existing value.


SEE ALSO

isapi(7), HttpFilterProc(3), HTTP_FILTER_CONTEXT(5).


FILES

$ZEUSHOME/web/include/httpfilt.h $ZEUSHOME/web/include/wintypes.h $ZEUSHOME/webadmin/docroot/docs/modules/isapi/*.html


COPYRIGHT

Copyright (C) 2000-2001 Zeus Technology Limited. All rights reserved.