WebSite
WebSite API 1.1 SDK
Transaction Context Block

Return to Overview

Rev 13-Apr-96
This is the per-request transaction context as used by WebSite. For more details, see the file wsapi.h supplied with the WSAPI SDK.
//---------------------
//  Transaction Context
//---------------------
//
// This is the structure that holds all of the public
// per-transaction data
//
typedef struct 
{
    CONST void *link;                   // Don't even THINK about this one
    //
    // Server Configuration
    //
    CONST HWND _hMainWnd;               // Server's Main window
    CONST BOOL bService;                // TRUE if running as NT service
    CONST BOOL bTraceHook;              // TRUE if want hook tracing
    CONST char *temp_path;              // Path to server's temp directory
    CONST char *server_version;         // Server's version string for headers
    //
    // Low-level
    //
    CONST SOCKET csd;                   // Client socket descriptor
    CONST DWORD dwPort;                 // IP port for this request
    CONST DWORD dwThreadID;             // Current Thread ID
    CONST DWORD dwStartTicks;           // SystemTicks at thread start
    CONST BOOL bSSL;                    // TRUE = Running on SSL
    //
    // Remote (client) identity
    //
    CONST char *remote_host;            // Client's host name or NULL if not found
    CONST char *remote_ip;              // Clients IP address (dotted quad)
    CONST char *remote_name;            // Client's host name if found, else IP address
    //
    // Local (server) identity
    //
    CONST char *local_name;             // Identity for multi-home
    CONST char *url_prefix;             // Multi-home URL prefix
    CONST char *local_CN;               // Certificate Common Name (CN)
    CONST BYTE *cert;                   // DER-format Certificate
    CONST DWORD cert_len;               // Length of Certificate
    //
    // HTTP Request info - may be changed by pre/post processor
    //
    CONST char http_request[MED_STRING_LEN];// HTTP raw request line (1st 256 chars)
    BOOL http_09;                       // TRUE if HTTP/0.9 request
    char method[SML_STRING_LEN];        // HTTP method
    char url[MAX_STRING_LEN];           // HTTP URL (decoded)
    char params[MED_STRING_LEN];        // HTTP URL Parameters (';' delimited)
    char args[MAX_STRING_LEN];          // HTTP arguments
    char http_accept[MAX_STRING_LEN];   // HTTP "Accept" line
    char if_mod_since[SML_STRING_LEN];  // HTTP "If-Modified-Since"
    char request_range[MED_STRING_LEN]; // HTTP "Request-Range"
    char unl_mod_since[SML_STRING_LEN]; // HTTP "Unless Modified Since"
    char referer[MAX_STRING_LEN];       // HTTP "Referer"
    char from[MED_STRING_LEN];          // HTTP "From"
    char user_agent[MED_STRING_LEN];    // HTTP "User-Agent"
    BOOL keep_alive;                    // TRUE if request has Connection: Keep-Alive
    //
    // Access Control & Authentication  (HTTP "Authorization")
    //
    char auth_line[MED_STRING_LEN];     // "Authorization" line
    char *auth_type;                    // "Authorization" type (strdup'd)
    char *auth_name;                    // "Authorization" Realm (strdup'd)
    char user[SML_STRING_LEN];          // User name
    char pass[SML_STRING_LEN];          // Password
    DWORD allow_options;                // Access options (SECOPT_ constants)
    //
    // Request content (if any), response content
    //
    long content_length;                    // HTTP "Content-Length"
    char content_type[SML_STRING_LEN];      // HTTP "Content-Type"
    char content_encoding[SML_STRING_LEN];  // HTTP "Content-Encoding"
    char location[MAX_STRING_LEN];          // HTTP "Location"
    char last_modified[SML_STRING_LEN];     // HTTP "Last-Modified"
    //
    // Response status line
    //
    char rsp_status[SML_STRING_LEN];    // e.g., HTTP/1.0 200 OK
    //
    // Extra header tuples.
    //
    long num_req_xhdr;                  // Number of request extra headers
    xhdr req_xhdr[MAX_EXT_HEADERS];     // Extra headers in request.
    long num_rsp_xhdr;                  // Number of response extra headers
    xhdr rsp_xhdr[MAX_EXT_HEADERS];     // Extra headers for response.
    //
    // Authentication Info
    //
    char user_to_check[SML_STRING_LEN]; // Server checks this username
    //
    // Open file for response (postprocessing hooks only!)
    //
    HANDLE hOutFile;
    //
    // Results (use only for logging!)
    //
    CONST int http_status;              // HTTP/1.0 status code of trans.
    CONST long bytes;                   // #bytes sent, excluding header
    //
    // User contexts
    //
    DWORD user_1;
    DWORD user_2;
} TCTX;

O'Reilly Tech Support <[email protected]>