# Private Request Definition

    /*
    **	(c) COPYRIGHT MIT 1995.
    **	Please first read the full copyright statement in the file COPYRIGH.
    */

This module is the private part of the request object. It has the functions declarations that are private to the Library and that shouldn't be used by applications. The module has been separated from the old HTAccess module. See also the public part of the declarition in the HTReq Module.

This module is implemented by HTReqMan.c, and it is a part of the W3C Reference Library.

    #ifndef HTREQMAN_H
    #define HTREQMAN_H

    #include "HTReq.h"
    #include "HTList.h"
    #include "HTFormat.h"
    #include "HTAnchor.h"
    #include "HTMethod.h"
    #include "HTAABrow.h"
    #include "HTStream.h"
    #include "HTNet.h"
    #include "HTMIMPrs.h"

When a request is handled, all kinds of things about it need to be passed along together with a request. It is intended to live as long as the request is still active, but can be deleted as soon as it has terminated. Only the anchor object stays around after the request itself is terminated.

    struct _HTRequest {

        BOOL		internal;      /* Does the app knows about this one? */

        time_t		date;      /* Time stamp when the request was issued */

        HTMethod		method;
        HTReload		reload;

        int			retrys;       	      /* Number of automatic reloads */
        time_t		retry_after;		 /* Absolut time for a retry */
        HTNet *		net;		    /* Information about socket etc. */
        HTPriority		priority;		/* Priority for this request */

### User Profile

Each request can be assigned a user profile containing information about this host and the user issuing the request.

        HTUserProfile *	userprofile;

### Accept headers

        HTList *		conversions;
        BOOL		conv_local;

        HTList *		encodings;
        BOOL		enc_local;

        HTList *		ctes;
        BOOL		cte_local;

        HTList *		languages;
        BOOL		lang_local;

        HTList *		charsets;
        BOOL		char_local;

        HTList *		befores;
        BOOL		befores_local;

        HTList *		afters;
        BOOL		afters_local;

### Headers and header information

        HTGnHd		GenMask;
        HTRsHd		ResponseMask;
        HTRqHd		RequestMask;
        HTEnHd		EntityMask;

        HTMIMEParseSet *	parseSet;
        BOOL		pars_local;

        HTList *		generators;
        BOOL		gens_local;

### Anchors

        HTParentAnchor *	anchor;	       /* The Client anchor for this request */

        HTChildAnchor *	childAnchor;	    /* For element within the object */
        HTParentAnchor *	parentAnchor;			/* For referer field */

#### Redirection

If we get a redirection back then we return the new destination for this request to the application using this anchor.

        HTAnchor *		redirectionAnchor;		  /* Redirection URL */

### Streams From Network to Application

        HTStream *		output_stream;
        HTFormat		output_format;
        BOOL		connected;

        HTStream*		debug_stream;
        HTFormat		debug_format;

### Streams From Application to Network

        HTStream *		input_stream;
        HTFormat		input_format;

### Callback Function for getting data down the Input Stream

        HTPostCallback *	PostCallback;

### Context Swapping

        HTRequestCallback *	callback;
        void *		context;

### Other Flags

        BOOL		preemptive;
        BOOL		ContentNegotiation;

        BOOL                full_uri;
        char * 		proxy;

        int                 max_forwards;

### Error Manager

        HTList *		error_stack;		           /* List of errors */

### PostWeb Information

        HTRequest *		source;		     /* Source for request or itself */
        HTParentAnchor *	source_anchor;		  /* Source anchor or itself */

        HTRequest *		mainDestination;	     /* For the typical case */
        HTList *		destinations;		 /* List of related requests */
        int			destRequests;	   /* Number of destination requests */
        int			destStreams;	    /* Number of destination streams */

### Cache Control Directives

This association list is a list of the cache control directives that are to be sent as part of the `Cache-Control` header. `Cache-control` directives can be sent in both directions - we keep the out-going ones here and the incoming becomes part of the anchor object.

        HTAssocList *       cache_control;

### Original Header Values

The cache uses (for the moment) the original header values when it creates a cache entry. We can pass the headers to the cache manager using this list

        HTAssocList *      headers;

### Connection Control Directives

This association list is a list of the connection control directives that are to be sent as part of the `Connection` header. `Connection` directives can be sent in both directions - that is - from the server to the client and vise-verse. In order to separate outgoing from incoming connections directives, we keep two lists - one for outgoing and one for incoming.

        HTAssocList *       client_connection;
        HTAssocList *       server_connection;

### Access Authentication Information

The `challenge` and the `credentials` entries are use by the authentication parsers and generators respectively.

        char *		realm;				    /* Current realm */
        char *		scheme;				   /* Current scheme */

        HTAssocList *	challenge;           /* Challenge received by client */
        HTAssocList *	credentials;	   /* Credentials received by server */

### Protocol Extension Protocol (PEP) Information

        HTAssocList *	protocol;
        HTAssocList *	protocol_info;
        HTAssocList *	protocol_request;

As a small alternative to the PEP protocol headers, we also support the extension header which works pretty much the same way but is somewhat simpler in use.

        HTAssocList *       client_extension;
        HTAssocList *       server_extension;

### Windows Specific Information

    #ifdef WWW_WIN_ASYNC
        HWND		hwnd;		/* Windows handle for MSWindows   */
        unsigned long	winMsg;	        /* msg number of Windows eloop    */
    #endif /* WWW_WIN_ASYNC */

    };

## Post Web Management

These functions are mainly used internally in the Library but there is no reason for them not to be public.

    extern BOOL HTRequest_addDestination (HTRequest * src, HTRequest * dest);
    extern BOOL HTRequest_removeDestination	(HTRequest * dest);
    extern BOOL HTRequest_destinationsReady (HTRequest * me);

    extern BOOL HTRequest_linkDestination (HTRequest * dest);
    extern BOOL HTRequest_unlinkDestination (HTRequest * dest);

    extern BOOL HTRequest_removePostWeb (HTRequest * me);
    extern BOOL HTRequest_killPostWeb (HTRequest * me);

    #define	HTRequest_mainDestination(me) \
    	((me) && (me)->source ? (me)->source->mainDestination : NULL)
    #define HTRequest_isDestination(me) \
    	((me) && (me)->source && (me) != (me)->source)
    #define HTRequest_isMainDestination(me) \
    	((me) && (me)->source && \
    	(me) == (me)->source->mainDestination)
    #define HTRequest_isSource(me) \
    	((me) && (me)->source && (me) == (me)->source)

End of Declaration

    #endif /* HTREQMAN_H */